[PR #25] [MERGED] feat: Ajouter la fonctionnalité de sélection d'utilisateurs pour l'ajout d'heures #83

Closed
opened 2026-05-06 12:18:38 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/BreizhHardware/Site-comptage-heure/pull/25
Author: @BreizhHardware
Created: 11/20/2025
Status: Merged
Merged: 11/20/2025
Merged by: @BreizhHardware

Base: devHead: feat/bulk-add-hours


📝 Commits (1)

  • 1ef7089 feat: Ajouter la fonctionnalité de sélection d'utilisateurs pour l'ajout d'heures

📊 Changes

2 files changed (+69 additions, -12 deletions)

View changed files

📝 app/admin/page.tsx (+35 -0)
📝 app/api/hours/route.ts (+34 -12)

📄 Description

This pull request adds the ability for admins to add hours on behalf of multiple users at once from the admin interface. The changes include updates to both the frontend (AdminPage) and backend (/api/hours route) to support selecting users, validating permissions, and handling the creation of hours for multiple users.

Frontend: User selection and form handling

  • Added a multi-user selection UI to the add hours form, allowing admins to select one or more users to attribute hours to; if left empty, hours are attributed to the current user. [1] [2]
  • Updated form submission logic to include selected user IDs in the payload and reset the selection after successful submission.

Backend: API and permission logic

  • Updated the /api/hours POST endpoint to accept an optional userIds array and to create hour entries for each selected user. [1] [2]
  • Implemented role-based permission checks: only admins and super admins can add hours for other users, and such entries are automatically validated. Non-admins can only add hours for themselves.

Closes #19


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BreizhHardware/Site-comptage-heure/pull/25 **Author:** [@BreizhHardware](https://github.com/BreizhHardware) **Created:** 11/20/2025 **Status:** ✅ Merged **Merged:** 11/20/2025 **Merged by:** [@BreizhHardware](https://github.com/BreizhHardware) **Base:** `dev` ← **Head:** `feat/bulk-add-hours` --- ### 📝 Commits (1) - [`1ef7089`](https://github.com/BreizhHardware/Site-comptage-heure/commit/1ef7089986b5b1e04250ac3f2266b882d078438f) feat: Ajouter la fonctionnalité de sélection d'utilisateurs pour l'ajout d'heures ### 📊 Changes **2 files changed** (+69 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `app/admin/page.tsx` (+35 -0) 📝 `app/api/hours/route.ts` (+34 -12) </details> ### 📄 Description This pull request adds the ability for admins to add hours on behalf of multiple users at once from the admin interface. The changes include updates to both the frontend (`AdminPage`) and backend (`/api/hours` route) to support selecting users, validating permissions, and handling the creation of hours for multiple users. **Frontend: User selection and form handling** - Added a multi-user selection UI to the add hours form, allowing admins to select one or more users to attribute hours to; if left empty, hours are attributed to the current user. [[1]](diffhunk://#diff-a7c2b21269eaaa6f291a758c44939732a9f1d9fe8e0d71a3a7822b813a196f43R97) [[2]](diffhunk://#diff-a7c2b21269eaaa6f291a758c44939732a9f1d9fe8e0d71a3a7822b813a196f43R391-R422) - Updated form submission logic to include selected user IDs in the payload and reset the selection after successful submission. **Backend: API and permission logic** - Updated the `/api/hours` POST endpoint to accept an optional `userIds` array and to create hour entries for each selected user. [[1]](diffhunk://#diff-53f5b1f527e0d09d7aee7f875a64881f5793a728b70fb4f6cb726c8c893ff048L68-R68) [[2]](diffhunk://#diff-53f5b1f527e0d09d7aee7f875a64881f5793a728b70fb4f6cb726c8c893ff048L77-R111) - Implemented role-based permission checks: only admins and super admins can add hours for other users, and such entries are automatically validated. Non-admins can only add hours for themselves. Closes #19 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 12:18:38 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
BreizhHardware/Site-comptage-heure#83
No description provided.