@silexpert/core 0.4.239 → 0.4.241
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.
- package/es/types/Interface/api/mail/QueryCountMail.d.ts +6 -5
- package/es/types/Interface/api/mail/QueryCountMail.d.ts.map +1 -1
- package/es/types/Interface/api/mail/QueryCountMail.js +5 -25
- package/es/types/Interface/api/mail/QueryCountMail.js.map +1 -1
- package/es/types/Interface/api/mail/QueryCountUnprocessedByUserMail.d.ts +6 -0
- package/es/types/Interface/api/mail/QueryCountUnprocessedByUserMail.d.ts.map +1 -0
- package/es/types/Interface/api/mail/QueryCountUnprocessedByUserMail.js +34 -0
- package/es/types/Interface/api/mail/QueryCountUnprocessedByUserMail.js.map +1 -0
- package/es/types/index.d.ts +2 -0
- package/es/types/index.d.ts.map +1 -1
- package/es/types/index.js +2 -0
- package/es/types/index.js.map +1 -1
- package/es/utils/date.d.ts +3 -0
- package/es/utils/date.d.ts.map +1 -0
- package/es/utils/date.js +38 -0
- package/es/utils/date.js.map +1 -0
- package/es/utils/webmail.js +4 -4
- package/es/utils/webmail.js.map +1 -1
- package/js/types/Interface/api/mail/QueryCountMail.js +2 -10
- package/js/types/Interface/api/mail/QueryCountMail.js.map +1 -1
- package/js/types/Interface/api/mail/QueryCountUnprocessedByUserMail.js +35 -0
- package/js/types/Interface/api/mail/QueryCountUnprocessedByUserMail.js.map +1 -0
- package/js/types/index.js +24 -0
- package/js/types/index.js.map +1 -1
- package/js/utils/date.js +83 -0
- package/js/utils/date.js.map +1 -0
- package/js/utils/webmail.js +3 -3
- package/js/utils/webmail.js.map +1 -1
- package/package.json +1 -1
- package/ts/types/Interface/api/mail/QueryCountMail.ts +7 -21
- package/ts/types/Interface/api/mail/QueryCountUnprocessedByUserMail.ts +25 -0
- package/ts/types/index.ts +2 -0
- package/ts/utils/date.ts +32 -0
- package/ts/utils/webmail.ts +3 -3
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IsBoolean,
|
|
3
|
-
IsInt,
|
|
4
3
|
IsOptional,
|
|
5
4
|
} from 'class-validator';
|
|
6
|
-
import {
|
|
5
|
+
import { WhereOptions, WhereValue } from 'sequelize';
|
|
6
|
+
import { Mail } from '../../../../api/resources/Mail';
|
|
7
|
+
import { ApiPropertyOptional } from '../../../../utils';
|
|
7
8
|
import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
|
|
8
9
|
|
|
9
10
|
export class QueryCountMail {
|
|
10
|
-
@ApiProperty()
|
|
11
|
-
@IsInt()
|
|
12
|
-
idUser: number;
|
|
13
|
-
|
|
14
|
-
@ApiPropertyOptional()
|
|
15
|
-
@IsOptional()
|
|
16
|
-
@IsBoolean()
|
|
17
|
-
@ToBoolean()
|
|
18
|
-
isWithoutSociety?: boolean;
|
|
19
|
-
|
|
20
|
-
@ApiPropertyOptional()
|
|
21
|
-
@IsOptional()
|
|
22
|
-
@IsBoolean()
|
|
23
|
-
@ToBoolean()
|
|
24
|
-
isSent?: boolean;
|
|
25
|
-
|
|
26
11
|
@ApiPropertyOptional()
|
|
27
12
|
@IsOptional()
|
|
28
13
|
@IsBoolean()
|
|
29
14
|
@ToBoolean()
|
|
30
|
-
|
|
15
|
+
distinct?: boolean;
|
|
31
16
|
|
|
32
17
|
@ApiPropertyOptional()
|
|
33
18
|
@IsOptional()
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
where?: {
|
|
20
|
+
[K in keyof Mail]?: WhereOptions | WhereValue
|
|
21
|
+
};
|
|
36
22
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IsBoolean,
|
|
3
|
+
IsInt,
|
|
4
|
+
IsOptional,
|
|
5
|
+
} from 'class-validator';
|
|
6
|
+
import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
|
|
7
|
+
import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
|
|
8
|
+
|
|
9
|
+
export class QueryCountUnprocessedByUserMail {
|
|
10
|
+
@ApiProperty()
|
|
11
|
+
@IsInt()
|
|
12
|
+
idUser: number;
|
|
13
|
+
|
|
14
|
+
@ApiPropertyOptional()
|
|
15
|
+
@IsOptional()
|
|
16
|
+
@IsBoolean()
|
|
17
|
+
@ToBoolean()
|
|
18
|
+
isWithoutSociety?: boolean;
|
|
19
|
+
|
|
20
|
+
@ApiPropertyOptional()
|
|
21
|
+
@IsOptional()
|
|
22
|
+
@IsBoolean()
|
|
23
|
+
@ToBoolean()
|
|
24
|
+
isCountingManagerRoleMails?: boolean;
|
|
25
|
+
}
|
package/ts/types/index.ts
CHANGED
|
@@ -480,6 +480,7 @@ export * from './Interface/api/mail/QueryPaginatedMail';
|
|
|
480
480
|
export * from './Interface/api/mail/QueryCountProcessedByUser';
|
|
481
481
|
export * from './Interface/api/mail/QueryGetAnsweringTimeByUser';
|
|
482
482
|
export * from './Interface/api/mail/QueryCountMail';
|
|
483
|
+
export * from './Interface/api/mail/QueryCountUnprocessedByUserMail';
|
|
483
484
|
export * from './Interface/api/mail/UpdateMail';
|
|
484
485
|
export * from './Interface/api/mail/CreateMailParams';
|
|
485
486
|
export * from './Interface/api/mail/UpdateMailParams';
|
|
@@ -758,6 +759,7 @@ export * from './Interface/enum/Date';
|
|
|
758
759
|
|
|
759
760
|
export * from '../utils/cerfa';
|
|
760
761
|
export * from '../utils/checklist';
|
|
762
|
+
export * from '../utils/date';
|
|
761
763
|
export * from './Interface/api/affectedPatrimony/CreateAffectedPatrimony';
|
|
762
764
|
export * from './Interface/api/affectedPatrimony/CreateInKindAffectedPatrimony';
|
|
763
765
|
export * from './Interface/api/affectedPatrimony/ResultCreateAffectedPatrimony';
|
package/ts/utils/date.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param dateStart (format YYYY-MM-DD)
|
|
3
|
+
* @param dateEnd (format YYYY-MM-DD)
|
|
4
|
+
* @returns object of date (09:00-10:00, 12:00-13:00 et 14:00-17:00)
|
|
5
|
+
*/
|
|
6
|
+
import * as dayjs from 'dayjs';
|
|
7
|
+
import * as isBetween from 'dayjs/plugin/isBetween';
|
|
8
|
+
import { ReadAttendanceHours, UpdateCalendarEvent } from '../types';
|
|
9
|
+
|
|
10
|
+
dayjs.extend(isBetween);
|
|
11
|
+
|
|
12
|
+
export async function checkRealHoursUser(customPayload: UpdateCalendarEvent, realHours: ReadAttendanceHours):Promise<UpdateCalendarEvent> {
|
|
13
|
+
const res = { ...customPayload };
|
|
14
|
+
if (realHours.datas.length > 0) {
|
|
15
|
+
const dateToCompareStart = dayjs(customPayload.dateStart).toDate();
|
|
16
|
+
const dateToCompareEnd = dayjs(customPayload.dateEnd).toDate();
|
|
17
|
+
const realHoursObject = realHours.datas;
|
|
18
|
+
|
|
19
|
+
// on cherche la bonne specialhour pour comparer les horaires
|
|
20
|
+
const realHoursOfPeriod = realHoursObject.filter((sh) => (sh.endTime && dayjs(dateToCompareStart).diff(dayjs(sh.endTime)) <= 0) && (sh.startTime && dayjs(dateToCompareEnd).diff(dayjs(sh.startTime)) >= 0));
|
|
21
|
+
|
|
22
|
+
if (realHoursOfPeriod?.length > 0 && realHoursOfPeriod[0].startTime && realHoursOfPeriod[0].endTime) {
|
|
23
|
+
const dateStart = dayjs(realHoursOfPeriod[0].startTime, 'YYYY-MM-DD HH:mm:ss').toDate();
|
|
24
|
+
const dateEnd = dayjs(realHoursOfPeriod[0].endTime, 'YYYY-MM-DD HH:mm:ss').toDate();
|
|
25
|
+
|
|
26
|
+
// on check si les horaires de l'event sont dans les horaires du collab sinon on les fait commencer à l'heure à laquelle il s'est connecté
|
|
27
|
+
res.dateStart = !(dayjs(dateToCompareStart).isBetween(dateStart, dateEnd, 'minutes', '[]')) ? dateStart : dateToCompareStart;
|
|
28
|
+
res.dateEnd = !(dayjs(dateToCompareEnd).isBetween(dateStart, dateEnd, 'minutes', '[]')) ? dateEnd : dateToCompareEnd;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return res;
|
|
32
|
+
}
|
package/ts/utils/webmail.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { Role } from '../types/Enum/Role';
|
|
|
2
2
|
|
|
3
3
|
const getIdRoleUsedForEmail = (listRoles: number[]): number => {
|
|
4
4
|
let idRole = Role.CUSTOMER_SUCCESS;
|
|
5
|
-
if (listRoles.includes(Role.
|
|
5
|
+
if (listRoles.includes(Role.BACK_MANAGER)) {
|
|
6
|
+
idRole = Role.BACK_MANAGER;
|
|
7
|
+
} else if (listRoles.includes(Role.FRONT_OFFICE)) {
|
|
6
8
|
idRole = Role.FRONT_OFFICE;
|
|
7
9
|
} else if (listRoles.includes(Role.FRONT_OFFICE_EXPRESS)) {
|
|
8
10
|
idRole = Role.FRONT_OFFICE_EXPRESS;
|
|
@@ -16,8 +18,6 @@ const getIdRoleUsedForEmail = (listRoles: number[]): number => {
|
|
|
16
18
|
idRole = Role.JURIDIC;
|
|
17
19
|
} else if (listRoles.includes(Role.SOCIAL)) {
|
|
18
20
|
idRole = Role.SOCIAL;
|
|
19
|
-
} else if (listRoles.includes(Role.BACK_MANAGER)) {
|
|
20
|
-
idRole = Role.BACK_MANAGER;
|
|
21
21
|
}
|
|
22
22
|
return idRole;
|
|
23
23
|
};
|