@silexpert/core 0.4.241 → 0.4.242
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/index.d.ts +0 -1
- package/es/types/index.d.ts.map +1 -1
- package/es/types/index.js +0 -1
- package/es/types/index.js.map +1 -1
- package/es/utils/date.d.ts +6 -1
- package/es/utils/date.d.ts.map +1 -1
- package/es/utils/date.js +16 -35
- package/es/utils/date.js.map +1 -1
- package/js/types/index.js +0 -12
- package/js/types/index.js.map +1 -1
- package/js/utils/date.js +15 -69
- package/js/utils/date.js.map +1 -1
- package/package.json +1 -1
- package/ts/types/index.ts +0 -1
- package/ts/utils/date.ts +9 -13
- package/es/types/Interface/api/mail/QueryCountMail.d.ts +0 -9
- package/es/types/Interface/api/mail/QueryCountMail.d.ts.map +0 -1
- package/es/types/Interface/api/mail/QueryCountMail.js +0 -27
- package/es/types/Interface/api/mail/QueryCountMail.js.map +0 -1
- package/js/types/Interface/api/mail/QueryCountMail.js +0 -33
- package/js/types/Interface/api/mail/QueryCountMail.js.map +0 -1
- package/ts/types/Interface/api/mail/QueryCountMail.ts +0 -22
package/ts/utils/date.ts
CHANGED
|
@@ -3,29 +3,25 @@
|
|
|
3
3
|
* @param dateEnd (format YYYY-MM-DD)
|
|
4
4
|
* @returns object of date (09:00-10:00, 12:00-13:00 et 14:00-17:00)
|
|
5
5
|
*/
|
|
6
|
-
import * as dayjs from 'dayjs';
|
|
7
|
-
import * as isBetween from 'dayjs/plugin/isBetween';
|
|
8
6
|
import { ReadAttendanceHours, UpdateCalendarEvent } from '../types';
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export async function checkRealHoursUser(customPayload: UpdateCalendarEvent, realHours: ReadAttendanceHours):Promise<UpdateCalendarEvent> {
|
|
8
|
+
export function checkIfintervalIsBetweenRealHours(customPayload: UpdateCalendarEvent, realHours: ReadAttendanceHours):UpdateCalendarEvent {
|
|
13
9
|
const res = { ...customPayload };
|
|
14
|
-
if (realHours.datas.length > 0) {
|
|
15
|
-
const dateToCompareStart =
|
|
16
|
-
const dateToCompareEnd =
|
|
10
|
+
if (realHours.datas.length > 0 && customPayload?.dateStart && customPayload?.dateEnd) {
|
|
11
|
+
const dateToCompareStart = new Date(customPayload.dateStart).getTime();
|
|
12
|
+
const dateToCompareEnd = new Date(customPayload.dateEnd).getTime();
|
|
17
13
|
const realHoursObject = realHours.datas;
|
|
18
14
|
|
|
19
15
|
// on cherche la bonne specialhour pour comparer les horaires
|
|
20
|
-
const realHoursOfPeriod = realHoursObject.filter((sh) => (sh.endTime &&
|
|
16
|
+
const realHoursOfPeriod = realHoursObject.filter((sh) => (sh.endTime && (dateToCompareStart - new Date(sh.endTime).getTime() <= 0)) && (sh.startTime && (dateToCompareEnd - new Date(sh.startTime).getTime() >= 0)));
|
|
21
17
|
|
|
22
18
|
if (realHoursOfPeriod?.length > 0 && realHoursOfPeriod[0].startTime && realHoursOfPeriod[0].endTime) {
|
|
23
|
-
const dateStart =
|
|
24
|
-
const dateEnd =
|
|
19
|
+
const dateStart = new Date(realHoursOfPeriod[0].startTime).getTime();
|
|
20
|
+
const dateEnd = new Date(realHoursOfPeriod[0].endTime).getTime();
|
|
25
21
|
|
|
26
22
|
// 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 = !(
|
|
28
|
-
res.dateEnd = !(
|
|
23
|
+
res.dateStart = !((dateToCompareStart - dateStart) >= 0 && (dateToCompareStart - dateEnd) <= 0) ? new Date(dateStart) : new Date(dateToCompareStart);
|
|
24
|
+
res.dateEnd = !((dateToCompareEnd - dateStart) >= 0 && (dateToCompareEnd - dateEnd) <= 0) ? new Date(dateEnd) : new Date(dateToCompareEnd);
|
|
29
25
|
}
|
|
30
26
|
}
|
|
31
27
|
return res;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { WhereOptions, WhereValue } from 'sequelize';
|
|
2
|
-
import { Mail } from '../../../../api/resources/Mail';
|
|
3
|
-
export declare class QueryCountMail {
|
|
4
|
-
distinct?: boolean;
|
|
5
|
-
where?: {
|
|
6
|
-
[K in keyof Mail]?: WhereOptions | WhereValue;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=QueryCountMail.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryCountMail.d.ts","sourceRoot":"","sources":["../../../../../ts/types/Interface/api/mail/QueryCountMail.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAItD,qBAAa,cAAc;IAKzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAInB,KAAK,CAAC,EAAE;SACL,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,YAAY,GAAG,UAAU;KAC9C,CAAC;CACH"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { IsBoolean, IsOptional, } from 'class-validator';
|
|
11
|
-
import { ApiPropertyOptional } from '../../../../utils';
|
|
12
|
-
import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
|
|
13
|
-
export class QueryCountMail {
|
|
14
|
-
}
|
|
15
|
-
__decorate([
|
|
16
|
-
ApiPropertyOptional(),
|
|
17
|
-
IsOptional(),
|
|
18
|
-
IsBoolean(),
|
|
19
|
-
ToBoolean(),
|
|
20
|
-
__metadata("design:type", Boolean)
|
|
21
|
-
], QueryCountMail.prototype, "distinct", void 0);
|
|
22
|
-
__decorate([
|
|
23
|
-
ApiPropertyOptional(),
|
|
24
|
-
IsOptional(),
|
|
25
|
-
__metadata("design:type", Object)
|
|
26
|
-
], QueryCountMail.prototype, "where", void 0);
|
|
27
|
-
//# sourceMappingURL=QueryCountMail.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryCountMail.js","sourceRoot":"","sources":["../../../../../ts/types/Interface/api/mail/QueryCountMail.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,SAAS,EACT,UAAU,GACX,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAE3E,MAAM,OAAO,cAAc;CAY1B;AAPC;IAJC,mBAAmB,EAAE;IACrB,UAAU,EAAE;IACZ,SAAS,EAAE;IACX,SAAS,EAAE;;gDACO;AAInB;IAFC,mBAAmB,EAAE;IACrB,UAAU,EAAE;;6CAGX","sourcesContent":["import {\n IsBoolean,\n IsOptional,\n} from 'class-validator';\nimport { WhereOptions, WhereValue } from 'sequelize';\nimport { Mail } from '../../../../api/resources/Mail';\nimport { ApiPropertyOptional } from '../../../../utils';\nimport { ToBoolean } from '../../../../utils/transforms/boolean.transform';\n\nexport class QueryCountMail {\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n distinct?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n where?: {\n [K in keyof Mail]?: WhereOptions | WhereValue\n };\n}\n"]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.QueryCountMail = undefined;
|
|
7
|
-
|
|
8
|
-
var _classValidator = require("class-validator");
|
|
9
|
-
|
|
10
|
-
var _utils = require("../../../../utils");
|
|
11
|
-
|
|
12
|
-
var _boolean = require("../../../../utils/transforms/boolean.transform");
|
|
13
|
-
|
|
14
|
-
var __decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
15
|
-
var c = arguments.length,
|
|
16
|
-
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
17
|
-
d;
|
|
18
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
19
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
var __metadata = undefined && undefined.__metadata || function (k, v) {
|
|
23
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
class QueryCountMail {}
|
|
27
|
-
|
|
28
|
-
exports.QueryCountMail = QueryCountMail;
|
|
29
|
-
|
|
30
|
-
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(), (0, _classValidator.IsBoolean)(), (0, _boolean.ToBoolean)(), __metadata("design:type", Boolean)], QueryCountMail.prototype, "distinct", void 0);
|
|
31
|
-
|
|
32
|
-
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(), __metadata("design:type", Object)], QueryCountMail.prototype, "where", void 0);
|
|
33
|
-
//# sourceMappingURL=QueryCountMail.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryCountMail.js","mappings":";;;;;;;AAAA;;AAMA;;AACA;;;;;;;;;;;;;;AAEM,MAAOA,cAAP,CAAqB;;QAAdA,c,GAAAA,c;;AAKXC,YAJC,iCAID,EAHC,iCAGD,EAFC,gCAED,EADC,yBACD;;AAIAA,YAFC,iCAED,EADC,iCACD","names":["QueryCountMail","__decorate"],"sourceRoot":"","sources":["../../../../../ts/types/Interface/api/mail/QueryCountMail.ts"],"sourcesContent":["import {\n IsBoolean,\n IsOptional,\n} from 'class-validator';\nimport { WhereOptions, WhereValue } from 'sequelize';\nimport { Mail } from '../../../../api/resources/Mail';\nimport { ApiPropertyOptional } from '../../../../utils';\nimport { ToBoolean } from '../../../../utils/transforms/boolean.transform';\n\nexport class QueryCountMail {\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n distinct?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n where?: {\n [K in keyof Mail]?: WhereOptions | WhereValue\n };\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IsBoolean,
|
|
3
|
-
IsOptional,
|
|
4
|
-
} from 'class-validator';
|
|
5
|
-
import { WhereOptions, WhereValue } from 'sequelize';
|
|
6
|
-
import { Mail } from '../../../../api/resources/Mail';
|
|
7
|
-
import { ApiPropertyOptional } from '../../../../utils';
|
|
8
|
-
import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
|
|
9
|
-
|
|
10
|
-
export class QueryCountMail {
|
|
11
|
-
@ApiPropertyOptional()
|
|
12
|
-
@IsOptional()
|
|
13
|
-
@IsBoolean()
|
|
14
|
-
@ToBoolean()
|
|
15
|
-
distinct?: boolean;
|
|
16
|
-
|
|
17
|
-
@ApiPropertyOptional()
|
|
18
|
-
@IsOptional()
|
|
19
|
-
where?: {
|
|
20
|
-
[K in keyof Mail]?: WhereOptions | WhereValue
|
|
21
|
-
};
|
|
22
|
-
}
|