@eliasrrosa/tutorhub-public-assets 0.3.0 → 0.5.0
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/dist/domain/entities/Class.d.ts +0 -5
- package/dist/domain/entities/FreeTimeSlot.d.ts +6 -11
- package/dist/domain/entities/FreeTimeSlot.js +2 -3
- package/dist/domain/entities/ISO8601Date.d.ts +3 -0
- package/dist/domain/entities/ISO8601Date.js +3 -0
- package/dist/domain/entities/ISO8601Date.test.js +1 -1
- package/dist/index.cjs +5 -3
- package/dist/index.js +5 -3
- package/package.json +1 -1
- package/dist/domain/entities/Class.test.d.ts +0 -1
- package/dist/domain/entities/Class.test.js +0 -64
- package/dist/domain/types/Class.d.ts +0 -2
- package/dist/domain/types/Class.js +0 -5
- package/dist/infrastructure/restful/requests/forms/CreateClassForm.d.ts +0 -16
- package/dist/infrastructure/restful/requests/forms/CreateClassForm.js +0 -2
- package/dist/restful/responses/GetFixedAvailableTimesResponseBody.d.ts +0 -5
- package/dist/restful/responses/GetFixedAvailableTimesResponseBody.js +0 -2
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { IClassStatus } from "./ClassStatus";
|
|
2
|
-
import { IDate } from "./Date";
|
|
3
|
-
import { ITime } from "./Time";
|
|
4
2
|
export interface IClass {
|
|
5
3
|
id: string;
|
|
6
4
|
title: string;
|
|
7
5
|
startDateTime: Date;
|
|
8
6
|
endDateTime: Date;
|
|
9
|
-
date: IDate;
|
|
10
|
-
startTime: ITime;
|
|
11
|
-
endTime: ITime;
|
|
12
7
|
courseId: string;
|
|
13
8
|
ownerId: string;
|
|
14
9
|
status: IClassStatus;
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import { IDate } from "./Date";
|
|
2
|
-
import { ITime } from "./Time";
|
|
3
1
|
export interface IFreeDateTimeSlot {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
endTime: ITime;
|
|
2
|
+
startDateTime: Date;
|
|
3
|
+
endDateTime: Date;
|
|
7
4
|
userId: string;
|
|
8
5
|
}
|
|
9
6
|
export declare class FreeDateTimeSlot implements IFreeDateTimeSlot {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
endTime: ITime;
|
|
7
|
+
startDateTime: Date;
|
|
8
|
+
endDateTime: Date;
|
|
13
9
|
userId: string;
|
|
14
10
|
constructor(opts: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
endTime: ITime;
|
|
11
|
+
startDateTime: Date;
|
|
12
|
+
endDateTime: Date;
|
|
18
13
|
userId: string;
|
|
19
14
|
});
|
|
20
15
|
}
|
|
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FreeDateTimeSlot = void 0;
|
|
4
4
|
class FreeDateTimeSlot {
|
|
5
5
|
constructor(opts) {
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
8
|
-
this.endTime = opts.endTime;
|
|
6
|
+
this.startDateTime = opts.startDateTime;
|
|
7
|
+
this.endDateTime = opts.endDateTime;
|
|
9
8
|
this.userId = opts.userId;
|
|
10
9
|
}
|
|
11
10
|
}
|
|
@@ -3,6 +3,9 @@ import { IDateValidator } from "./DateValidator";
|
|
|
3
3
|
export declare class ISO8601Date implements IDate {
|
|
4
4
|
readonly value: string;
|
|
5
5
|
validator: IDateValidator;
|
|
6
|
+
/**Accepts YYYY-MM-DD date format. All other characters after this will be disconsidered.
|
|
7
|
+
* Disconsiders timezones.
|
|
8
|
+
*/
|
|
6
9
|
constructor(value?: string);
|
|
7
10
|
private throwIfFormatIsNotValid;
|
|
8
11
|
getDay: () => string;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ISO8601Date = void 0;
|
|
4
4
|
const ISO8601DateValidator_1 = require("./ISO8601DateValidator");
|
|
5
5
|
class ISO8601Date {
|
|
6
|
+
/**Accepts YYYY-MM-DD date format. All other characters after this will be disconsidered.
|
|
7
|
+
* Disconsiders timezones.
|
|
8
|
+
*/
|
|
6
9
|
constructor(value) {
|
|
7
10
|
this.validator = new ISO8601DateValidator_1.ISO8601DateValidator();
|
|
8
11
|
this.getDay = () => {
|
|
@@ -19,7 +19,7 @@ describe("ISO8601Date", () => {
|
|
|
19
19
|
};
|
|
20
20
|
expect(instantiateDate).toThrow();
|
|
21
21
|
});
|
|
22
|
-
it("Should throw if value contains timezone or other strings", () => {
|
|
22
|
+
it("Should not throw if value contains timezone or other strings, but must not consider it.", () => {
|
|
23
23
|
const instantiateDate = () => {
|
|
24
24
|
return new ISO8601Date_1.ISO8601Date("2025-01-01T00:00:00Z");
|
|
25
25
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -92,6 +92,9 @@ var ISO8601DateValidator = class {
|
|
|
92
92
|
|
|
93
93
|
// src/domain/entities/ISO8601Date.ts
|
|
94
94
|
var _ISO8601Date = class _ISO8601Date {
|
|
95
|
+
/**Accepts YYYY-MM-DD date format. All other characters after this will be disconsidered.
|
|
96
|
+
* Disconsiders timezones.
|
|
97
|
+
*/
|
|
95
98
|
constructor(value) {
|
|
96
99
|
this.validator = new ISO8601DateValidator();
|
|
97
100
|
this.getDay = () => {
|
|
@@ -591,9 +594,8 @@ var UserUnavailableTime = class {
|
|
|
591
594
|
// src/domain/entities/FreeTimeSlot.ts
|
|
592
595
|
var FreeDateTimeSlot = class {
|
|
593
596
|
constructor(opts) {
|
|
594
|
-
this.
|
|
595
|
-
this.
|
|
596
|
-
this.endTime = opts.endTime;
|
|
597
|
+
this.startDateTime = opts.startDateTime;
|
|
598
|
+
this.endDateTime = opts.endDateTime;
|
|
597
599
|
this.userId = opts.userId;
|
|
598
600
|
}
|
|
599
601
|
};
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,9 @@ var ISO8601DateValidator = class {
|
|
|
54
54
|
|
|
55
55
|
// src/domain/entities/ISO8601Date.ts
|
|
56
56
|
var _ISO8601Date = class _ISO8601Date {
|
|
57
|
+
/**Accepts YYYY-MM-DD date format. All other characters after this will be disconsidered.
|
|
58
|
+
* Disconsiders timezones.
|
|
59
|
+
*/
|
|
57
60
|
constructor(value) {
|
|
58
61
|
this.validator = new ISO8601DateValidator();
|
|
59
62
|
this.getDay = () => {
|
|
@@ -553,9 +556,8 @@ var UserUnavailableTime = class {
|
|
|
553
556
|
// src/domain/entities/FreeTimeSlot.ts
|
|
554
557
|
var FreeDateTimeSlot = class {
|
|
555
558
|
constructor(opts) {
|
|
556
|
-
this.
|
|
557
|
-
this.
|
|
558
|
-
this.endTime = opts.endTime;
|
|
559
|
+
this.startDateTime = opts.startDateTime;
|
|
560
|
+
this.endDateTime = opts.endDateTime;
|
|
559
561
|
this.userId = opts.userId;
|
|
560
562
|
}
|
|
561
563
|
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const Class_1 = require("./Class");
|
|
4
|
-
describe("Class", () => {
|
|
5
|
-
describe("Class constructor", () => {
|
|
6
|
-
const classData = {
|
|
7
|
-
id: "id",
|
|
8
|
-
title: "title",
|
|
9
|
-
date: "2025-01-01",
|
|
10
|
-
startTime: "12:00:00+03:00",
|
|
11
|
-
endTime: "13:00:00+03:00",
|
|
12
|
-
courseId: "courseId",
|
|
13
|
-
ownerId: "ownerId",
|
|
14
|
-
status: "pending",
|
|
15
|
-
updatedAt: "2025-01-01T00:00:00Z",
|
|
16
|
-
createdAt: "2025-01-01T00:00:00Z",
|
|
17
|
-
groupId: "groupId",
|
|
18
|
-
description: "description",
|
|
19
|
-
paymentId: "paymentId",
|
|
20
|
-
meetingLink: "meetingLink",
|
|
21
|
-
contractId: "contractId",
|
|
22
|
-
};
|
|
23
|
-
it("Should not throw given correct arguments", () => {
|
|
24
|
-
const aClass = () => new Class_1.Class(classData);
|
|
25
|
-
expect(aClass).not.toThrow();
|
|
26
|
-
});
|
|
27
|
-
it("Should throw given incorrect startTime format", () => {
|
|
28
|
-
const aClass = () => new Class_1.Class(Object.assign(Object.assign({}, classData), { startTime: "12" }));
|
|
29
|
-
expect(aClass).toThrow();
|
|
30
|
-
});
|
|
31
|
-
it("Should throw given incorrect endTime format", () => {
|
|
32
|
-
const aClass = () => new Class_1.Class(Object.assign(Object.assign({}, classData), { endTime: "24:00:00" }));
|
|
33
|
-
expect(aClass).toThrow();
|
|
34
|
-
});
|
|
35
|
-
it("Should throw given startTime greater than endTime", () => {
|
|
36
|
-
const aClass = () => new Class_1.Class(Object.assign(Object.assign({}, classData), { startTime: "12:00:00", endTime: "11:59:00" }));
|
|
37
|
-
expect(aClass).toThrow();
|
|
38
|
-
});
|
|
39
|
-
it("Should throw given startTime equal to endTime", () => {
|
|
40
|
-
const aClass = () => new Class_1.Class(Object.assign(Object.assign({}, classData), { startTime: "12:00:00", endTime: "12:00:00" }));
|
|
41
|
-
expect(aClass).toThrow();
|
|
42
|
-
});
|
|
43
|
-
it("Should throw given invalid status", () => {
|
|
44
|
-
const aClass = () => new Class_1.Class(Object.assign(Object.assign({}, classData), { status: "invalid status" }));
|
|
45
|
-
expect(aClass).toThrow();
|
|
46
|
-
});
|
|
47
|
-
it("Should throw given empty title", () => {
|
|
48
|
-
const aClass = () => new Class_1.Class(Object.assign(Object.assign({}, classData), { title: "" }));
|
|
49
|
-
expect(aClass).toThrow();
|
|
50
|
-
});
|
|
51
|
-
it("Should throw given incorrect date format", () => {
|
|
52
|
-
const aClass = () => new Class_1.Class(Object.assign(Object.assign({}, classData), { date: "2025-13-01" }));
|
|
53
|
-
expect(aClass).toThrow();
|
|
54
|
-
});
|
|
55
|
-
it("Should not throw given date with time and timezone", () => {
|
|
56
|
-
const aClass = () => new Class_1.Class(Object.assign(Object.assign({}, classData), { date: "2025-02-01T00:00:00Z" }));
|
|
57
|
-
expect(aClass).not.toThrow();
|
|
58
|
-
});
|
|
59
|
-
it("Should throw given createdAt greater than updatedAt", () => {
|
|
60
|
-
const aClass = () => new Class_1.Class(Object.assign(Object.assign({}, classData), { createdAt: "2025-01-02", updatedAt: "2025-01-01" }));
|
|
61
|
-
expect(aClass).toThrow();
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ClassCreationRecurrenceRule } from "../../../../domain/types/ClassCreationRecurrenceRule";
|
|
2
|
-
import { ClassStatus } from "../../../../domain/types/ClassStatus";
|
|
3
|
-
export type CreateClassForm = {
|
|
4
|
-
title: string;
|
|
5
|
-
date: string;
|
|
6
|
-
time: string;
|
|
7
|
-
endTime: string;
|
|
8
|
-
courseId: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
id?: string;
|
|
11
|
-
status?: ClassStatus;
|
|
12
|
-
recurrenceRule?: ClassCreationRecurrenceRule;
|
|
13
|
-
recurrenceEndDate?: string;
|
|
14
|
-
groupId?: string;
|
|
15
|
-
meetingLink?: string;
|
|
16
|
-
};
|