feat: ajout des commentaires à la semaine (#15)
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [x] Pas de régression - [ ] TU/TI/TF rédigée - [x] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: #15 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #15.
This commit is contained in:
@@ -89,6 +89,8 @@ export type WeeklyWorkHourRowSummary = {
|
||||
weeklyOvernightCount?: number
|
||||
hasContractForWeek?: boolean
|
||||
contractNature?: 'CDI' | 'CDD' | 'INTERIM' | null
|
||||
comment?: string | null
|
||||
commentId?: number | null
|
||||
}
|
||||
|
||||
export type WeeklyWorkHourSummary = {
|
||||
|
||||
24
frontend/services/employee-week-comments.ts
Normal file
24
frontend/services/employee-week-comments.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
export type EmployeeWeekComment = {
|
||||
id: number
|
||||
weekStartDate: string
|
||||
content: string
|
||||
}
|
||||
|
||||
export const createWeekComment = async (payload: { employeeId: number; weekStartDate: string; content: string }) => {
|
||||
const api = useApi()
|
||||
return api.post<EmployeeWeekComment>('/employee_week_comments', {
|
||||
employee: `/api/employees/${payload.employeeId}`,
|
||||
weekStartDate: payload.weekStartDate,
|
||||
content: payload.content
|
||||
}, { toastSuccessKey: 'success.weekComment.save', toastErrorKey: 'errors.weekComment.save' })
|
||||
}
|
||||
|
||||
export const updateWeekComment = async (id: number, content: string) => {
|
||||
const api = useApi()
|
||||
return api.patch<EmployeeWeekComment>(`/employee_week_comments/${id}`, { content }, { toastSuccessKey: 'success.weekComment.save', toastErrorKey: 'errors.weekComment.save' })
|
||||
}
|
||||
|
||||
export const deleteWeekComment = async (id: number) => {
|
||||
const api = useApi()
|
||||
await api.delete(`/employee_week_comments/${id}`, {}, { toastSuccessKey: 'success.weekComment.delete', toastErrorKey: 'errors.weekComment.delete' })
|
||||
}
|
||||
Reference in New Issue
Block a user