@silexpert/core 2.0.14 → 2.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/api/resources/User.d.ts +7 -1
  2. package/dist/api/resources/User.d.ts.map +1 -1
  3. package/dist/api/resources/User.js +19 -0
  4. package/dist/api/resources/User.js.map +1 -1
  5. package/dist/api/resources/UsersHistory.d.ts +11 -0
  6. package/dist/api/resources/UsersHistory.d.ts.map +1 -0
  7. package/dist/api/resources/UsersHistory.js +28 -0
  8. package/dist/api/resources/UsersHistory.js.map +1 -0
  9. package/dist/api/resources.d.ts +2 -0
  10. package/dist/api/resources.d.ts.map +1 -1
  11. package/dist/api/resources.js +2 -0
  12. package/dist/api/resources.js.map +1 -1
  13. package/dist/types/Enum/UsersHistory.d.ts +17 -0
  14. package/dist/types/Enum/UsersHistory.d.ts.map +1 -0
  15. package/dist/types/Enum/UsersHistory.js +38 -0
  16. package/dist/types/Enum/UsersHistory.js.map +1 -0
  17. package/dist/types/Interface/api/team/UpdateTeamsForUser.d.ts +1 -1
  18. package/dist/types/Interface/api/team/UpdateTeamsForUser.d.ts.map +1 -1
  19. package/dist/types/Interface/api/team/UpdateTeamsForUser.js +7 -6
  20. package/dist/types/Interface/api/team/UpdateTeamsForUser.js.map +1 -1
  21. package/dist/types/Interface/api/user/UpdateCoworker.d.ts +1 -0
  22. package/dist/types/Interface/api/user/UpdateCoworker.d.ts.map +1 -1
  23. package/dist/types/Interface/api/user/UpdateCoworker.js +7 -0
  24. package/dist/types/Interface/api/user/UpdateCoworker.js.map +1 -1
  25. package/dist/types/Interface/api/usersHistory/Create.d.ts +9 -0
  26. package/dist/types/Interface/api/usersHistory/Create.d.ts.map +1 -0
  27. package/dist/types/Interface/api/usersHistory/Create.js +40 -0
  28. package/dist/types/Interface/api/usersHistory/Create.js.map +1 -0
  29. package/dist/types/Interface/api/usersHistory/Update.d.ts +8 -0
  30. package/dist/types/Interface/api/usersHistory/Update.d.ts.map +1 -0
  31. package/dist/types/Interface/api/usersHistory/Update.js +35 -0
  32. package/dist/types/Interface/api/usersHistory/Update.js.map +1 -0
  33. package/dist/types/Interface/models/IUsersHistory.d.ts +20 -0
  34. package/dist/types/Interface/models/IUsersHistory.d.ts.map +1 -0
  35. package/dist/types/Interface/models/IUsersHistory.js +2 -0
  36. package/dist/types/Interface/models/IUsersHistory.js.map +1 -0
  37. package/dist/types/index.d.ts +4 -1
  38. package/dist/types/index.d.ts.map +1 -1
  39. package/dist/types/index.js +4 -1
  40. package/dist/types/index.js.map +1 -1
  41. package/package.json +1 -1
  42. package/ts/api/resources/User.ts +28 -1
  43. package/ts/api/resources/UsersHistory.ts +35 -0
  44. package/ts/api/resources.ts +2 -0
  45. package/ts/types/Enum/UsersHistory.ts +42 -0
  46. package/ts/types/Interface/api/team/UpdateTeamsForUser.ts +6 -4
  47. package/ts/types/Interface/api/user/UpdateCoworker.ts +5 -0
  48. package/ts/types/Interface/api/usersHistory/Create.ts +25 -0
  49. package/ts/types/Interface/api/usersHistory/Update.ts +21 -0
  50. package/ts/types/Interface/models/IUsersHistory.ts +24 -0
  51. package/ts/types/index.ts +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "2.0.14",
3
+ "version": "2.0.15",
4
4
  "description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
5
5
  "homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
6
6
  "type": "module",
@@ -26,6 +26,7 @@ import {
26
26
  CreateCollaboraterDetail,
27
27
  IWorkingSchedule,
28
28
  ICollaboraterDetail,
29
+ IUsersHistory,
29
30
  } from '../../types/index.js';
30
31
 
31
32
  export class User extends Resource {
@@ -189,7 +190,6 @@ export class User extends Resource {
189
190
  registerProspect(body: RegisterProspectBody): Promise<RegisterProspectResponse> {
190
191
  return this.axios.$post('users/prospect', body);
191
192
  }
192
-
193
193
  updateCoworkerWorkingSchedules(idUser: number, workingSchedules: IWorkingSchedule[]): Promise<IWorkingSchedule[]> {
194
194
  return this.axios.$post(`users/coworker/${idUser}/working-schedules`, workingSchedules);
195
195
  }
@@ -212,4 +212,31 @@ export class User extends Resource {
212
212
  updateCollaboraterDetail(id: number, params: Partial<ICollaboraterDetail>): Promise<ICollaboraterDetail> {
213
213
  return this.axios.$put(`collaboraters-details/${id}`, params);
214
214
  }
215
+
216
+ //user history
217
+
218
+ createUserHistory(body: IUsersHistory): Promise<IUsersHistory> {
219
+ return this.axios.$post('usersHistory', body);
220
+ }
221
+
222
+ getAllUserHistory(): Promise<IUsersHistory[]> {
223
+ return this.axios.$get('usersHistory');
224
+ }
225
+
226
+ getUserHistoryById(id: number): Promise<IUsersHistory> {
227
+ return this.axios.$get(`usersHistory/${id}`);
228
+ }
229
+
230
+ getUserHistoryByUserID(id: number): Promise<IUsersHistory[]> {
231
+ return this.axios.$get(`usersHistory/user/${id}`);
232
+ }
233
+
234
+ updateUserHistory(id: number, body: IUsersHistory): Promise<IUsersHistory> {
235
+ return this.axios.$put(`usersHistory/${id}`, body);
236
+ }
237
+
238
+ deleteUserHistory(id: number): Promise<number> {
239
+ return this.axios.$delete(`usersHistory/${id}`);
240
+ }
241
+
215
242
  }
@@ -0,0 +1,35 @@
1
+ import { Resource } from '../Resource.js';
2
+ import { IUsersHistory, CreateUsersHistory, UpdateUsersHistory } from '../../types/index.js';
3
+
4
+ export class UsersHistory extends Resource {
5
+ createUserHistory(body: CreateUsersHistory): Promise<IUsersHistory> {
6
+ return this.axios.$post('usersHistory', body);
7
+ }
8
+
9
+ getAllUserHistory(signal?: AbortSignal): Promise<IUsersHistory[]> {
10
+ return this.axios.$get('usersHistory', {
11
+ ...signal && { signal }
12
+ });
13
+ }
14
+
15
+ getUserHistoryById(id: number, signal?: AbortSignal): Promise<IUsersHistory> {
16
+ return this.axios.$get(`usersHistory/${id}`, {
17
+ ...signal && { signal }
18
+ });
19
+ }
20
+
21
+ getUserHistoryByUserID(idUser: number, signal?: AbortSignal): Promise<IUsersHistory[]> {
22
+ return this.axios.$get(`usersHistory/user/${idUser}`, {
23
+ ...signal && { signal }
24
+ });
25
+ }
26
+
27
+ updateUserHistory(id: number, body: UpdateUsersHistory): Promise<IUsersHistory> {
28
+ return this.axios.$put(`usersHistory/${id}`, body);
29
+ }
30
+
31
+ deleteUserHistory(id: number): Promise<boolean> {
32
+ return this.axios.$delete(`usersHistory/${id}`);
33
+ }
34
+
35
+ }
@@ -192,6 +192,7 @@ import { LoginApproval } from './resources/LoginApproval.js';
192
192
  import { SocietyApproval } from './resources/SocietyApproval.js';
193
193
  import { Docoon } from './resources/Docoon.js';
194
194
  import { Acd } from './resources/Acd.js';
195
+ import { UsersHistory } from './resources/UsersHistory.js';
195
196
 
196
197
  export const resources = {
197
198
  budgetInsight: BudgetInsight,
@@ -387,5 +388,6 @@ export const resources = {
387
388
  loginApproval: LoginApproval,
388
389
  societyApproval: SocietyApproval,
389
390
  docoon: Docoon,
391
+ usersHistory: UsersHistory,
390
392
  acd: Acd,
391
393
  };
@@ -0,0 +1,42 @@
1
+ export enum TypeUserHistory {
2
+ // Cycle de vie Compte
3
+ CREATE = 1,
4
+ UPDATE = 2,
5
+ DELETE = 3,
6
+ RESTORE = 4,
7
+
8
+ // Validation & Modifications Spécifiques
9
+ INFO_UPDATE = 5, // Info ok
10
+ ROLE_UPDATE = 6, // Role ok
11
+
12
+ // Sécurité
13
+ PASSWORD_UPDATE = 7,
14
+
15
+ // Gestion Matériel
16
+ EQUIPMENT_ASSIGN = 8,
17
+ EQUIPMENT_BROKEN = 9,
18
+ EQUIPMENT_RETURN = 10,
19
+ EQUIPMENT_LOST = 11,
20
+
21
+ // Communication
22
+ MAIL_SENT_TO_TS = 12, // Mail envoyé à TS
23
+
24
+ //Equipe
25
+ TEAM_MOUVEMENT = 13,
26
+ }
27
+
28
+ export const TypeUserHistoryLabels: Record<TypeUserHistory, string> = {
29
+ [TypeUserHistory.CREATE]: 'Création',
30
+ [TypeUserHistory.UPDATE]: 'Mise à jour',
31
+ [TypeUserHistory.DELETE]: 'Suppression',
32
+ [TypeUserHistory.RESTORE]: 'Restauration',
33
+ [TypeUserHistory.INFO_UPDATE]: 'Mise à jour Info',
34
+ [TypeUserHistory.ROLE_UPDATE]: 'Mise à jour Rôle',
35
+ [TypeUserHistory.PASSWORD_UPDATE]: 'Changement Mot de passe',
36
+ [TypeUserHistory.EQUIPMENT_ASSIGN]: 'Assignation Matériel',
37
+ [TypeUserHistory.EQUIPMENT_BROKEN]: 'Matériel Cassé',
38
+ [TypeUserHistory.EQUIPMENT_RETURN]: 'Retour Matériel',
39
+ [TypeUserHistory.EQUIPMENT_LOST]: 'Matériel Perdu',
40
+ [TypeUserHistory.MAIL_SENT_TO_TS]: 'Mail envoyé à TS',
41
+ [TypeUserHistory.TEAM_MOUVEMENT]: 'Changement d\'équipe',
42
+ };
@@ -1,4 +1,4 @@
1
- import { IsArray, IsBoolean, IsInt, IsNumber, IsOptional } from 'class-validator';
1
+ import { IsArray, IsBoolean, IsInt, IsOptional } from 'class-validator';
2
2
  import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
3
3
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform.js';
4
4
 
@@ -14,8 +14,10 @@ export class UpdateTeamsForUser {
14
14
  @ToBoolean()
15
15
  replace?: boolean;
16
16
 
17
- @ApiPropertyOptional()
17
+ @ApiPropertyOptional({ type: [Number] })
18
18
  @IsOptional()
19
- @IsNumber()
20
- oldTeamId?: number;
19
+ @IsArray()
20
+ @IsInt({ each: true })
21
+ oldTeamIds?: number[];
22
+
21
23
  }
@@ -110,6 +110,11 @@ export class UpdateCorworker implements IUser {
110
110
  @IsArray()
111
111
  idRoles?: number[];
112
112
 
113
+ @ApiPropertyOptional()
114
+ @IsOptional()
115
+ @IsArray()
116
+ idOldRoles?: number[];
117
+
113
118
  @ApiPropertyOptional()
114
119
  @IsOptional()
115
120
  @IsArray()
@@ -0,0 +1,25 @@
1
+ import { IsEnum, IsInt, IsOptional, IsString } from 'class-validator';
2
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
3
+ import { TypeUserHistory } from '../../../Enum/UsersHistory.js';
4
+ import { IUsersHistory, IMetadata } from '../../models/IUsersHistory.js';
5
+
6
+ export class CreateUsersHistory implements Omit<IUsersHistory, 'id' | 'createdAt' | 'updatedAt' | 'idAuthor'> {
7
+ @ApiProperty()
8
+ @IsInt()
9
+ idUser: number;
10
+
11
+
12
+
13
+ @ApiPropertyOptional()
14
+ @IsOptional()
15
+ @IsString()
16
+ comment?: string;
17
+
18
+ @ApiProperty()
19
+ @IsEnum(TypeUserHistory)
20
+ actionType: TypeUserHistory;
21
+
22
+ @ApiPropertyOptional({ type: 'object', additionalProperties: true })
23
+ @IsOptional()
24
+ metadata?: IMetadata;
25
+ }
@@ -0,0 +1,21 @@
1
+ import { IsEnum, IsOptional, IsString } from 'class-validator';
2
+ import { ApiPropertyOptional } from '@nestjs/swagger';
3
+ import { TypeUserHistory } from '../../../Enum/UsersHistory.js';
4
+ import { IUsersHistory, IMetadata } from '../../models/IUsersHistory.js';
5
+
6
+
7
+ export class UpdateUsersHistory implements Partial<Omit<IUsersHistory, 'id' | 'idUser' | 'idAuthor'>> {
8
+ @ApiPropertyOptional()
9
+ @IsOptional()
10
+ @IsString()
11
+ comment?: string;
12
+
13
+ @ApiPropertyOptional()
14
+ @IsOptional()
15
+ @IsEnum(TypeUserHistory)
16
+ actionType?: TypeUserHistory;
17
+
18
+ @ApiPropertyOptional({ type: 'object', additionalProperties: true })
19
+ @IsOptional()
20
+ metadata?: IMetadata;
21
+ }
@@ -0,0 +1,24 @@
1
+ import { IUser } from './IUser.js';
2
+ import { TypeUserHistory } from '../../Enum/UsersHistory.js';
3
+
4
+ export interface IUsersHistory {
5
+ id?: number;
6
+ idUser: number;
7
+ idAuthor?: number | null;
8
+ comment?: string | null;
9
+ actionType: TypeUserHistory;
10
+ createdAt?: Date | null;
11
+ updatedAt?: Date | null;
12
+ metadata?: IMetadata;
13
+
14
+
15
+ // Relations
16
+ user?: IUser;
17
+ author?: IUser;
18
+ }
19
+
20
+ export interface IMetadata {
21
+ leaveId?: number[];
22
+ joinId?: number[];
23
+ stayId?: number[];
24
+ }
package/ts/types/index.ts CHANGED
@@ -339,6 +339,7 @@ export * from './Interface/models/IInformationRequest.js';
339
339
  export * from './Interface/models/IRevenueMovement.js';
340
340
  export * from './Interface/models/IRevenueSnapshot.js';
341
341
  export * from './Interface/models/IEInvoicingEligibilityRequest.js';
342
+ export * from './Interface/models/IUsersHistory.js';
342
343
 
343
344
  // Schemas
344
345
  export * from './Interface/schemas/IRegistrationDetail.js';
@@ -513,7 +514,6 @@ export * from './Enum/Annotation.js';
513
514
  export * from './Enum/ProcessingState.js';
514
515
  export * from './Enum/InpiType.js';
515
516
  export * from './Enum/DepositDocumentType.js';
516
- export * from './Enum/Exercice.js';
517
517
  export * from './Enum/StatusSignature.js';
518
518
  export * from './Enum/BankCollectingState.js';
519
519
  export * from './Enum/Phone.js';
@@ -581,6 +581,7 @@ export * from './Enum/InformationRequestType.js';
581
581
  export * from './Enum/InformationRequestState.js';
582
582
  export * from './Enum/Revenue.js';
583
583
  export * from './Enum/EbookIntention.js';
584
+ export * from './Enum/UsersHistory.js';
584
585
 
585
586
  // Interfaces API
586
587
  export * from './Interface/api/acd/Create.js';
@@ -809,6 +810,8 @@ export * from './Interface/api/constitutionHistory/QueryPaginatedConstitutionHis
809
810
  export * from './Interface/api/userSpecialDay/BodyUserSpecialDay.js';
810
811
  export * from './Interface/api/userSpecialDay/QueryUserSpecialDay.js';
811
812
  export * from './Interface/api/oldExportInfo/OldExpertInfos.js';
813
+ export * from './Interface/api/usersHistory/Create.js';
814
+ export * from './Interface/api/usersHistory/Update.js';
812
815
 
813
816
  // export * from './Interface/api/survey/QuerySurvey.js';
814
817
  export * from './Interface/api/survey/ReadSurvey.js';