@eliasrrosa/tutorhub-public-assets 0.0.2 → 0.0.4
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/index.cjs +341 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +21 -0
- package/package.json +14 -4
- package/dist/entities/AsaasCustomer.d.ts +0 -14
- package/dist/entities/AsaasCustomer.js +0 -13
- package/dist/entities/Class.d.ts +0 -79
- package/dist/entities/Class.js +0 -30
- package/dist/entities/ClassRequest.d.ts +0 -15
- package/dist/entities/ClassRequest.js +0 -2
- package/dist/entities/Contract.d.ts +0 -40
- package/dist/entities/Contract.js +0 -2
- package/dist/entities/Course.d.ts +0 -34
- package/dist/entities/Course.js +0 -2
- package/dist/entities/CourseToSchoolConnectionRequest.d.ts +0 -10
- package/dist/entities/CourseToSchoolConnectionRequest.js +0 -2
- package/dist/entities/Date.d.ts +0 -56
- package/dist/entities/Date.js +0 -2
- package/dist/entities/Date.test.d.ts +0 -0
- package/dist/entities/Date.test.js +0 -23
- package/dist/entities/DateTimeSlot.d.ts +0 -6
- package/dist/entities/DateTimeSlot.js +0 -2
- package/dist/entities/DateValidator.d.ts +0 -3
- package/dist/entities/DateValidator.js +0 -2
- package/dist/entities/File.d.ts +0 -23
- package/dist/entities/File.js +0 -2
- package/dist/entities/FreeTimeSlot.d.ts +0 -19
- package/dist/entities/FreeTimeSlot.js +0 -12
- package/dist/entities/GenericNotification.d.ts +0 -11
- package/dist/entities/GenericNotification.js +0 -2
- package/dist/entities/GoogleAuth.d.ts +0 -8
- package/dist/entities/GoogleAuth.js +0 -2
- package/dist/entities/GoogleCalendar.d.ts +0 -10
- package/dist/entities/GoogleCalendar.js +0 -2
- package/dist/entities/GoogleCalendarEvent.d.ts +0 -10
- package/dist/entities/GoogleCalendarEvent.js +0 -2
- package/dist/entities/ISO8601Date.d.ts +0 -35
- package/dist/entities/ISO8601Date.js +0 -86
- package/dist/entities/ISO8601Date.test.d.ts +0 -1
- package/dist/entities/ISO8601Date.test.js +0 -210
- package/dist/entities/ISO8601DateTime.d.ts +0 -41
- package/dist/entities/ISO8601DateTime.js +0 -44
- package/dist/entities/ISO8601DateTime.test.d.ts +0 -1
- package/dist/entities/ISO8601DateTime.test.js +0 -146
- package/dist/entities/ISO8601DateValidator.d.ts +0 -13
- package/dist/entities/ISO8601DateValidator.js +0 -20
- package/dist/entities/ISO8601DateValidator.test.d.ts +0 -1
- package/dist/entities/ISO8601DateValidator.test.js +0 -15
- package/dist/entities/ISO8601Time.d.ts +0 -25
- package/dist/entities/ISO8601Time.js +0 -57
- package/dist/entities/ISO8601Time.test.d.ts +0 -1
- package/dist/entities/ISO8601Time.test.js +0 -63
- package/dist/entities/ISO8601TimeValidator.d.ts +0 -12
- package/dist/entities/ISO8601TimeValidator.js +0 -19
- package/dist/entities/ISO8601TimeValidator.test.d.ts +0 -1
- package/dist/entities/ISO8601TimeValidator.test.js +0 -42
- package/dist/entities/PasswordRecovery.d.ts +0 -6
- package/dist/entities/PasswordRecovery.js +0 -2
- package/dist/entities/Payment.d.ts +0 -42
- package/dist/entities/Payment.js +0 -2
- package/dist/entities/PaymentRecognitionRequest.d.ts +0 -12
- package/dist/entities/PaymentRecognitionRequest.js +0 -2
- package/dist/entities/PreApprovedUser.d.ts +0 -12
- package/dist/entities/PreApprovedUser.js +0 -2
- package/dist/entities/RescheduleRequest.d.ts +0 -16
- package/dist/entities/RescheduleRequest.js +0 -2
- package/dist/entities/School.d.ts +0 -31
- package/dist/entities/School.js +0 -2
- package/dist/entities/SchoolConnection.d.ts +0 -10
- package/dist/entities/SchoolConnection.js +0 -2
- package/dist/entities/SchoolConnectionRequest.d.ts +0 -7
- package/dist/entities/SchoolConnectionRequest.js +0 -2
- package/dist/entities/SchoolStudent.d.ts +0 -14
- package/dist/entities/SchoolStudent.js +0 -2
- package/dist/entities/SchoolTeacher.d.ts +0 -14
- package/dist/entities/SchoolTeacher.js +0 -2
- package/dist/entities/Time.d.ts +0 -9
- package/dist/entities/Time.js +0 -2
- package/dist/entities/TimeSlot.d.ts +0 -4
- package/dist/entities/TimeSlot.js +0 -2
- package/dist/entities/TimeValidator.d.ts +0 -3
- package/dist/entities/TimeValidator.js +0 -2
- package/dist/entities/UnauthorizedUser.d.ts +0 -16
- package/dist/entities/UnauthorizedUser.js +0 -2
- package/dist/entities/UserAuth.d.ts +0 -72
- package/dist/entities/UserAuth.js +0 -2
- package/dist/entities/UserConnection.d.ts +0 -8
- package/dist/entities/UserConnection.js +0 -2
- package/dist/entities/UserConnectionRequest.d.ts +0 -9
- package/dist/entities/UserConnectionRequest.js +0 -2
- package/dist/entities/UserCredentials.d.ts +0 -16
- package/dist/entities/UserCredentials.js +0 -11
- package/dist/entities/UserNavigation.d.ts +0 -8
- package/dist/entities/UserNavigation.js +0 -2
- package/dist/entities/UserPreferences.d.ts +0 -6
- package/dist/entities/UserPreferences.js +0 -2
- package/dist/entities/UserPremium.d.ts +0 -13
- package/dist/entities/UserPremium.js +0 -2
- package/dist/entities/UserProfile.d.ts +0 -9
- package/dist/entities/UserProfile.js +0 -2
- package/dist/entities/UserRoles.d.ts +0 -11
- package/dist/entities/UserRoles.js +0 -2
- package/dist/entities/UserSharedFileTimestamps.d.ts +0 -9
- package/dist/entities/UserSharedFileTimestamps.js +0 -2
- package/dist/entities/UserUnavailableTime.d.ts +0 -49
- package/dist/entities/UserUnavailableTime.js +0 -32
- package/dist/entities/UserUnavailableTime.test.d.ts +0 -1
- package/dist/entities/UserUnavailableTime.test.js +0 -22
- package/dist/repositories/UnavailableTimeRepository.d.ts +0 -20
- package/dist/repositories/UnavailableTimeRepository.js +0 -2
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { IDate } from "./Date";
|
|
2
|
-
import { ITime } from "./Time";
|
|
3
|
-
export interface IDateTime {
|
|
4
|
-
date: IDate;
|
|
5
|
-
time: ITime;
|
|
6
|
-
getJSDateTime: () => Date;
|
|
7
|
-
/**
|
|
8
|
-
* Returns DateTime string with added Brazilian timezone (-03:00) without converting the date or time.
|
|
9
|
-
* This function is analogous to ISO8601DateTime.getIsoString(-180)
|
|
10
|
-
* @returns an ISO8601 string with Brazilian timezone
|
|
11
|
-
*/
|
|
12
|
-
getBrazilianIsoString: () => string;
|
|
13
|
-
/**
|
|
14
|
-
* Returns DateTime string with added timezone (eg. +03:00, -01:00, .000Z) without converting the date or time.
|
|
15
|
-
* @param timezoneOffsetMinutes defaults to 0.
|
|
16
|
-
* Can be derived from the negative return value of Date.getTimezoneOffset()
|
|
17
|
-
* @param newDate overrides the date for the output string, but does not change state.
|
|
18
|
-
* @param newTime overrides the time for the output string, but does not change state.
|
|
19
|
-
* @returns an ISO8601 string with the added timezone.
|
|
20
|
-
*/
|
|
21
|
-
getIsoString: (opts?: {
|
|
22
|
-
timezoneOffsetMinutes?: number;
|
|
23
|
-
newDate?: IDate;
|
|
24
|
-
newTime?: ITime;
|
|
25
|
-
}) => string;
|
|
26
|
-
}
|
|
27
|
-
export declare class ISO8601DateTime implements IDateTime {
|
|
28
|
-
date: IDate;
|
|
29
|
-
time: ITime;
|
|
30
|
-
constructor(opts: {
|
|
31
|
-
date: IDate;
|
|
32
|
-
time: ITime;
|
|
33
|
-
});
|
|
34
|
-
getJSDateTime: () => Date;
|
|
35
|
-
getBrazilianIsoString: () => string;
|
|
36
|
-
getIsoString(opts?: {
|
|
37
|
-
timezoneOffsetMinutes?: number;
|
|
38
|
-
newDate?: IDate;
|
|
39
|
-
newTime?: ITime;
|
|
40
|
-
}): string;
|
|
41
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ISO8601DateTime = void 0;
|
|
4
|
-
class ISO8601DateTime {
|
|
5
|
-
constructor(opts) {
|
|
6
|
-
this.getJSDateTime = () => {
|
|
7
|
-
return new Date(parseInt(this.date.getYear()), parseInt(this.date.getMonth()) - 1, parseInt(this.date.getDay()), parseInt(this.time.getHours()), parseInt(this.time.getMinutes()), parseInt(this.time.getSeconds()));
|
|
8
|
-
};
|
|
9
|
-
this.getBrazilianIsoString = () => {
|
|
10
|
-
return this.getIsoString({
|
|
11
|
-
timezoneOffsetMinutes: -180,
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
this.date = opts.date;
|
|
15
|
-
this.time = opts.time;
|
|
16
|
-
}
|
|
17
|
-
getIsoString(opts) {
|
|
18
|
-
const padLeft = (n) => String(n).padStart(2, "0");
|
|
19
|
-
const newDateTime = new ISO8601DateTime({
|
|
20
|
-
date: (opts === null || opts === void 0 ? void 0 : opts.newDate) || this.date,
|
|
21
|
-
time: (opts === null || opts === void 0 ? void 0 : opts.newTime) || this.time,
|
|
22
|
-
});
|
|
23
|
-
const jsDate = newDateTime.getJSDateTime();
|
|
24
|
-
const year = jsDate.getFullYear();
|
|
25
|
-
const month = padLeft(jsDate.getMonth() + 1);
|
|
26
|
-
const day = padLeft(jsDate.getDate());
|
|
27
|
-
const hour = padLeft(jsDate.getHours());
|
|
28
|
-
const minute = padLeft(jsDate.getMinutes());
|
|
29
|
-
const second = padLeft(jsDate.getSeconds());
|
|
30
|
-
const timezoneOffsetMinutes = (opts === null || opts === void 0 ? void 0 : opts.timezoneOffsetMinutes)
|
|
31
|
-
? opts.timezoneOffsetMinutes
|
|
32
|
-
: 0;
|
|
33
|
-
const sign = timezoneOffsetMinutes == 0
|
|
34
|
-
? undefined
|
|
35
|
-
: timezoneOffsetMinutes < 0
|
|
36
|
-
? "-"
|
|
37
|
-
: "+";
|
|
38
|
-
const offsetHours = padLeft(Math.floor(Math.abs(timezoneOffsetMinutes) / 60));
|
|
39
|
-
const offsetMinutes = padLeft(Math.abs(timezoneOffsetMinutes) % 60);
|
|
40
|
-
const timezone = sign ? `${sign}${offsetHours}:${offsetMinutes}` : ".000Z";
|
|
41
|
-
return `${year}-${month}-${day}T${hour}:${minute}:${second}${timezone}`;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.ISO8601DateTime = ISO8601DateTime;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const ISO8601Date_1 = require("./ISO8601Date");
|
|
4
|
-
const ISO8601DateTime_1 = require("./ISO8601DateTime");
|
|
5
|
-
const ISO8601Time_1 = require("./ISO8601Time");
|
|
6
|
-
describe("ISO8601DateTime", () => {
|
|
7
|
-
describe("ISO8601DateTime getJSDateTime()", () => {
|
|
8
|
-
it("Should return a JS Date object.", () => {
|
|
9
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
10
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-01"),
|
|
11
|
-
time: new ISO8601Time_1.ISO8601Time("10:00:00"),
|
|
12
|
-
});
|
|
13
|
-
const jsDateTime = dateTime.getJSDateTime();
|
|
14
|
-
expect(jsDateTime).toBeInstanceOf(Date);
|
|
15
|
-
});
|
|
16
|
-
it("Should return the same year, month and day when returning UTC date.", () => {
|
|
17
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
18
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
19
|
-
time: new ISO8601Time_1.ISO8601Time("00:00:00"),
|
|
20
|
-
});
|
|
21
|
-
const jsDateTime = dateTime.getJSDateTime();
|
|
22
|
-
expect(jsDateTime.getUTCDate()).toBe(2);
|
|
23
|
-
expect(jsDateTime.getUTCMonth()).toBe(0);
|
|
24
|
-
expect(jsDateTime.getUTCFullYear()).toBe(2025);
|
|
25
|
-
});
|
|
26
|
-
it("Should return locale date string of same date and time as constructed.", () => {
|
|
27
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
28
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
29
|
-
time: new ISO8601Time_1.ISO8601Time("01:02:03"),
|
|
30
|
-
});
|
|
31
|
-
const jsDateTime = dateTime.getJSDateTime();
|
|
32
|
-
expect(jsDateTime.toLocaleDateString("pt-BR")).toBe("02/01/2025");
|
|
33
|
-
});
|
|
34
|
-
it("Should return ISO string converted to UTC.", () => {
|
|
35
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
36
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
37
|
-
time: new ISO8601Time_1.ISO8601Time("01:02:03"),
|
|
38
|
-
});
|
|
39
|
-
const jsDateTime = dateTime.getJSDateTime();
|
|
40
|
-
expect(jsDateTime.toISOString()).toBe("2025-01-02T04:02:03.000Z");
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
describe("ISO8601DateTime.getBrazilianIsoString()", () => {
|
|
44
|
-
it("Should return ISO string converted to Brazilian time.", () => {
|
|
45
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
46
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
47
|
-
time: new ISO8601Time_1.ISO8601Time("01:02:03"),
|
|
48
|
-
});
|
|
49
|
-
const brazilianIsoString = dateTime.getBrazilianIsoString();
|
|
50
|
-
expect(brazilianIsoString).toBe("2025-01-02T01:02:03-03:00");
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
describe("ISO8601DateTime.getIsoString()", () => {
|
|
54
|
-
it("Should return ISO UTC string if no arguments.", () => {
|
|
55
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
56
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
57
|
-
time: new ISO8601Time_1.ISO8601Time("03:01:02"),
|
|
58
|
-
});
|
|
59
|
-
const utcIsoString = dateTime.getIsoString();
|
|
60
|
-
expect(utcIsoString).toBe("2025-01-02T03:01:02.000Z");
|
|
61
|
-
});
|
|
62
|
-
it("Should return ISO string +01:00 for London timezone.", () => {
|
|
63
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
64
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
65
|
-
time: new ISO8601Time_1.ISO8601Time("03:01:02"),
|
|
66
|
-
});
|
|
67
|
-
const isoString = dateTime.getIsoString({ timezoneOffsetMinutes: 60 });
|
|
68
|
-
expect(isoString).toBe("2025-01-02T03:01:02+01:00");
|
|
69
|
-
});
|
|
70
|
-
it("Should return ISO string -05:00 for Chicago DST timezone.", () => {
|
|
71
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
72
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
73
|
-
time: new ISO8601Time_1.ISO8601Time("03:01:02"),
|
|
74
|
-
});
|
|
75
|
-
const isoString = dateTime.getIsoString({
|
|
76
|
-
timezoneOffsetMinutes: -300,
|
|
77
|
-
});
|
|
78
|
-
expect(isoString).toBe("2025-01-02T03:01:02-05:00");
|
|
79
|
-
});
|
|
80
|
-
it("Should return ISO string -03:00 for Brazilian timezone.", () => {
|
|
81
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
82
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
83
|
-
time: new ISO8601Time_1.ISO8601Time("03:01:02"),
|
|
84
|
-
});
|
|
85
|
-
const isoString = dateTime.getIsoString({
|
|
86
|
-
timezoneOffsetMinutes: -180,
|
|
87
|
-
});
|
|
88
|
-
expect(isoString).toBe("2025-01-02T03:01:02-03:00");
|
|
89
|
-
});
|
|
90
|
-
it("Should return ISO string -03:00 for Brazilian timezone derived from Date.", () => {
|
|
91
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
92
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
93
|
-
time: new ISO8601Time_1.ISO8601Time("03:01:02"),
|
|
94
|
-
});
|
|
95
|
-
const isoString = dateTime.getIsoString({
|
|
96
|
-
timezoneOffsetMinutes: -new Date().getTimezoneOffset(),
|
|
97
|
-
});
|
|
98
|
-
expect(isoString).toBe("2025-01-02T03:01:02-03:00");
|
|
99
|
-
});
|
|
100
|
-
it("Should accept newDate and properly output it.", () => {
|
|
101
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
102
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
103
|
-
time: new ISO8601Time_1.ISO8601Time("03:01:02"),
|
|
104
|
-
});
|
|
105
|
-
const isoString = dateTime.getIsoString({
|
|
106
|
-
timezoneOffsetMinutes: -new Date().getTimezoneOffset(),
|
|
107
|
-
newDate: new ISO8601Date_1.ISO8601Date("2025-01-03"),
|
|
108
|
-
});
|
|
109
|
-
expect(isoString).toBe("2025-01-03T03:01:02-03:00");
|
|
110
|
-
});
|
|
111
|
-
it("Should accept newTime and properly output it.", () => {
|
|
112
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
113
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
114
|
-
time: new ISO8601Time_1.ISO8601Time("03:01:02"),
|
|
115
|
-
});
|
|
116
|
-
const isoString = dateTime.getIsoString({
|
|
117
|
-
timezoneOffsetMinutes: -new Date().getTimezoneOffset(),
|
|
118
|
-
newTime: new ISO8601Time_1.ISO8601Time("03:01:03")
|
|
119
|
-
});
|
|
120
|
-
expect(isoString).toBe("2025-01-02T03:01:03-03:00");
|
|
121
|
-
});
|
|
122
|
-
it("Should accept newTime and newDate and properly output them.", () => {
|
|
123
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
124
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
125
|
-
time: new ISO8601Time_1.ISO8601Time("03:01:02"),
|
|
126
|
-
});
|
|
127
|
-
const isoString = dateTime.getIsoString({
|
|
128
|
-
timezoneOffsetMinutes: -new Date().getTimezoneOffset(),
|
|
129
|
-
newTime: new ISO8601Time_1.ISO8601Time("03:01:03"),
|
|
130
|
-
newDate: new ISO8601Date_1.ISO8601Date("2025-01-03")
|
|
131
|
-
});
|
|
132
|
-
expect(isoString).toBe("2025-01-03T03:01:03-03:00");
|
|
133
|
-
});
|
|
134
|
-
it("Should accept newTime and newDate and properly output them, even when timezone is UTC.", () => {
|
|
135
|
-
const dateTime = new ISO8601DateTime_1.ISO8601DateTime({
|
|
136
|
-
date: new ISO8601Date_1.ISO8601Date("2025-01-02"),
|
|
137
|
-
time: new ISO8601Time_1.ISO8601Time("03:01:02"),
|
|
138
|
-
});
|
|
139
|
-
const isoString = dateTime.getIsoString({
|
|
140
|
-
newTime: new ISO8601Time_1.ISO8601Time("03:01:03"),
|
|
141
|
-
newDate: new ISO8601Date_1.ISO8601Date("2025-01-03")
|
|
142
|
-
});
|
|
143
|
-
expect(isoString).toBe("2025-01-03T03:01:03.000Z");
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IDateValidator } from "./DateValidator";
|
|
2
|
-
/**
|
|
3
|
-
* Accepted format: YYYY-MM-DD
|
|
4
|
-
* @throws on construction if format is wrong
|
|
5
|
-
* @throws on get methods if format is wrong
|
|
6
|
-
*/
|
|
7
|
-
export declare class ISO8601DateValidator implements IDateValidator {
|
|
8
|
-
private YYYYmmDD;
|
|
9
|
-
/**
|
|
10
|
-
* Accepted format: YYYY-MM-DD
|
|
11
|
-
*/
|
|
12
|
-
formatIsValid(date: string): boolean;
|
|
13
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ISO8601DateValidator = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Accepted format: YYYY-MM-DD
|
|
6
|
-
* @throws on construction if format is wrong
|
|
7
|
-
* @throws on get methods if format is wrong
|
|
8
|
-
*/
|
|
9
|
-
class ISO8601DateValidator {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.YYYYmmDD = new RegExp("^[0-9]{4}-([0][1-9]|[1][0-2])-([0][1-9]|[1-2][0-9]|[3][0-1])$");
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Accepted format: YYYY-MM-DD
|
|
15
|
-
*/
|
|
16
|
-
formatIsValid(date) {
|
|
17
|
-
return this.YYYYmmDD.test(date);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.ISO8601DateValidator = ISO8601DateValidator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const ISO8601DateValidator_1 = require("./ISO8601DateValidator");
|
|
4
|
-
describe("ISO8601DateValidator", () => {
|
|
5
|
-
describe("ISO8601DateValidator.formatIsValid()", () => {
|
|
6
|
-
it("Should return true if format is YYYY-MM-DD.", () => {
|
|
7
|
-
const date = new ISO8601DateValidator_1.ISO8601DateValidator();
|
|
8
|
-
expect(date.formatIsValid("2025-01-01")).toBe(true);
|
|
9
|
-
});
|
|
10
|
-
it("Should return false if format is not YYYY-MM-DD.", () => {
|
|
11
|
-
const date = new ISO8601DateValidator_1.ISO8601DateValidator();
|
|
12
|
-
expect(date.formatIsValid("2025-01-011")).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IISO8601TimeValidator } from "./ISO8601TimeValidator";
|
|
2
|
-
import { ITime } from "./Time";
|
|
3
|
-
/**
|
|
4
|
-
* Interface for interacting with ISO8601 time formats.
|
|
5
|
-
* Accepted formats: HH:MM:SS and HH:MM.
|
|
6
|
-
*
|
|
7
|
-
* @throws if instantiated with a different format
|
|
8
|
-
* @throws if any method is called with a different format
|
|
9
|
-
*/
|
|
10
|
-
export declare class ISO8601Time implements ITime {
|
|
11
|
-
readonly value: string;
|
|
12
|
-
readonly validator: IISO8601TimeValidator;
|
|
13
|
-
/**
|
|
14
|
-
* Throws if format is invalid.
|
|
15
|
-
* Accepted formats: HH:MM:SS and HH:MM.
|
|
16
|
-
*/
|
|
17
|
-
constructor(value?: string);
|
|
18
|
-
private validateFormatOrThrow;
|
|
19
|
-
getTime(): string;
|
|
20
|
-
getMinutes(): string;
|
|
21
|
-
getHours(): string;
|
|
22
|
-
getSeconds(): string;
|
|
23
|
-
static getNow(): string;
|
|
24
|
-
getNow: typeof ISO8601Time.getNow;
|
|
25
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ISO8601Time = void 0;
|
|
4
|
-
const ISO8601TimeValidator_1 = require("./ISO8601TimeValidator");
|
|
5
|
-
/**
|
|
6
|
-
* Interface for interacting with ISO8601 time formats.
|
|
7
|
-
* Accepted formats: HH:MM:SS and HH:MM.
|
|
8
|
-
*
|
|
9
|
-
* @throws if instantiated with a different format
|
|
10
|
-
* @throws if any method is called with a different format
|
|
11
|
-
*/
|
|
12
|
-
class ISO8601Time {
|
|
13
|
-
/**
|
|
14
|
-
* Throws if format is invalid.
|
|
15
|
-
* Accepted formats: HH:MM:SS and HH:MM.
|
|
16
|
-
*/
|
|
17
|
-
constructor(value) {
|
|
18
|
-
this.validator = new ISO8601TimeValidator_1.ISO8601TimeValidator();
|
|
19
|
-
this.getNow = ISO8601Time.getNow;
|
|
20
|
-
this.value = value ? value : this.getNow();
|
|
21
|
-
this.validateFormatOrThrow();
|
|
22
|
-
}
|
|
23
|
-
validateFormatOrThrow() {
|
|
24
|
-
if (!this.validator.formatIsValid(this.value))
|
|
25
|
-
throw new Error("Time format must be ISO8601.");
|
|
26
|
-
}
|
|
27
|
-
getTime() {
|
|
28
|
-
this.validateFormatOrThrow();
|
|
29
|
-
if (this.validator.isHHmm(this.value)) {
|
|
30
|
-
return `${this.value}:00`;
|
|
31
|
-
}
|
|
32
|
-
return this.value;
|
|
33
|
-
}
|
|
34
|
-
getMinutes() {
|
|
35
|
-
this.validateFormatOrThrow();
|
|
36
|
-
return this.value.split(":")[1];
|
|
37
|
-
}
|
|
38
|
-
getHours() {
|
|
39
|
-
this.validateFormatOrThrow();
|
|
40
|
-
return this.value.split(":")[0];
|
|
41
|
-
}
|
|
42
|
-
getSeconds() {
|
|
43
|
-
this.validateFormatOrThrow();
|
|
44
|
-
const seconds = this.value.split(":")[2];
|
|
45
|
-
if (seconds)
|
|
46
|
-
return seconds;
|
|
47
|
-
return "00";
|
|
48
|
-
}
|
|
49
|
-
static getNow() {
|
|
50
|
-
const nowDate = new Date();
|
|
51
|
-
const hours = nowDate.getHours().toString().padStart(2, "0");
|
|
52
|
-
const minutes = nowDate.getMinutes().toString().padStart(2, "0");
|
|
53
|
-
const seconds = nowDate.getSeconds().toString().padStart(2, "0");
|
|
54
|
-
return `${hours}:${minutes}:${seconds}`;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.ISO8601Time = ISO8601Time;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const ISO8601Time_1 = require("./ISO8601Time");
|
|
4
|
-
describe("ISO8601Time", () => {
|
|
5
|
-
beforeAll(() => {
|
|
6
|
-
jest.useFakeTimers({
|
|
7
|
-
now: new Date("2025-01-01T23:00:00-03:00"),
|
|
8
|
-
legacyFakeTimers: false,
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
afterAll(() => {
|
|
12
|
-
jest.useRealTimers();
|
|
13
|
-
});
|
|
14
|
-
describe("ISO8601Time constructor", () => {
|
|
15
|
-
it("Should construct with no arguments.", () => {
|
|
16
|
-
const time = new ISO8601Time_1.ISO8601Time();
|
|
17
|
-
expect(time).toBeDefined();
|
|
18
|
-
});
|
|
19
|
-
it("Should construct with now time when receiving no arguments.", () => {
|
|
20
|
-
const time = new ISO8601Time_1.ISO8601Time();
|
|
21
|
-
expect(time.value).toBe("23:00:00");
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
describe("ISO8601Time.getNow()", () => {
|
|
25
|
-
it("Should get now time.", () => {
|
|
26
|
-
expect(ISO8601Time_1.ISO8601Time.getNow()).toBe("23:00:00");
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
describe("ISO8601Time.getHours()", () => {
|
|
30
|
-
it("Should return hours when valid", () => {
|
|
31
|
-
const time = new ISO8601Time_1.ISO8601Time("00:01");
|
|
32
|
-
expect(time.getHours()).toBe("00");
|
|
33
|
-
const time2 = new ISO8601Time_1.ISO8601Time("00:01:02");
|
|
34
|
-
expect(time2.getHours()).toBe("00");
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
describe("ISO8601Time.getMinutes()", () => {
|
|
38
|
-
it("Should return minutes when valid", () => {
|
|
39
|
-
const time = new ISO8601Time_1.ISO8601Time("00:01");
|
|
40
|
-
expect(time.getMinutes()).toBe("01");
|
|
41
|
-
const time2 = new ISO8601Time_1.ISO8601Time("00:01:02");
|
|
42
|
-
expect(time2.getMinutes()).toBe("01");
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
describe("ISO8601Time.getSeconds()", () => {
|
|
46
|
-
it("Should return seconds when valid", () => {
|
|
47
|
-
const time2 = new ISO8601Time_1.ISO8601Time("00:01:02");
|
|
48
|
-
expect(time2.getSeconds()).toBe("02");
|
|
49
|
-
});
|
|
50
|
-
it("Should return 00 when seconds are not present.", () => {
|
|
51
|
-
const time = new ISO8601Time_1.ISO8601Time("00:01");
|
|
52
|
-
expect(time.getSeconds()).toBe("00");
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
describe("ISO8601Time.getTime()", () => {
|
|
56
|
-
it("Should return time when valid", () => {
|
|
57
|
-
const time = new ISO8601Time_1.ISO8601Time("00:01");
|
|
58
|
-
expect(time.getTime()).toBe("00:01:00");
|
|
59
|
-
const time2 = new ISO8601Time_1.ISO8601Time("00:01:02");
|
|
60
|
-
expect(time2.getTime()).toBe("00:01:02");
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ITimeValidator } from "./TimeValidator";
|
|
2
|
-
export interface IISO8601TimeValidator extends ITimeValidator {
|
|
3
|
-
isHHmmSS: (time: string) => boolean;
|
|
4
|
-
isHHmm: (time: string) => boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare class ISO8601TimeValidator implements ITimeValidator {
|
|
7
|
-
private hhMMssPattern;
|
|
8
|
-
private hhMMPattern;
|
|
9
|
-
formatIsValid(time: string): boolean;
|
|
10
|
-
isHHmmSS(time: string): boolean;
|
|
11
|
-
isHHmm(time: string): boolean;
|
|
12
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ISO8601TimeValidator = void 0;
|
|
4
|
-
class ISO8601TimeValidator {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.hhMMssPattern = new RegExp("^([0-1][0-9]|[2][0-3]):[0-5][0-9]:[0-5][0-9]$");
|
|
7
|
-
this.hhMMPattern = new RegExp("^([0-1][0-9]|[2][0-3]):[0-5][0-9]$");
|
|
8
|
-
}
|
|
9
|
-
formatIsValid(time) {
|
|
10
|
-
return this.isHHmm(time) || this.isHHmmSS(time);
|
|
11
|
-
}
|
|
12
|
-
isHHmmSS(time) {
|
|
13
|
-
return this.hhMMssPattern.test(time);
|
|
14
|
-
}
|
|
15
|
-
isHHmm(time) {
|
|
16
|
-
return this.hhMMPattern.test(time);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.ISO8601TimeValidator = ISO8601TimeValidator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const ISO8601TimeValidator_1 = require("./ISO8601TimeValidator");
|
|
4
|
-
describe("ISO8601TimeValidator", () => {
|
|
5
|
-
const validator = new ISO8601TimeValidator_1.ISO8601TimeValidator();
|
|
6
|
-
describe("ISO8601TimeValidator.formatIsValid()", () => {
|
|
7
|
-
it("Should not accept ISO8601 timestamp with offset.", () => {
|
|
8
|
-
const time = "00:00:00-03:00";
|
|
9
|
-
expect(validator.formatIsValid(time)).toBe(false);
|
|
10
|
-
});
|
|
11
|
-
it("Should not accept ISO8601 format with timestamp.", () => {
|
|
12
|
-
const time = "00:00:00-02:00";
|
|
13
|
-
expect(validator.formatIsValid(time)).toBe(false);
|
|
14
|
-
});
|
|
15
|
-
it("Should not accept non-ISO8601 formats.", () => {
|
|
16
|
-
const moreCharactersAtTheEnd = "00:00:00-03:000";
|
|
17
|
-
const moreCharactersAtTheStart = "000:00:00-03:00";
|
|
18
|
-
expect(validator.formatIsValid(moreCharactersAtTheEnd)).toBe(false);
|
|
19
|
-
expect(validator.formatIsValid(moreCharactersAtTheStart)).toBe(false);
|
|
20
|
-
});
|
|
21
|
-
it("Should accept HH:MM format", () => {
|
|
22
|
-
const time = "00:00";
|
|
23
|
-
expect(validator.formatIsValid(time)).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
it("Should accept HH:MM:SS format", () => {
|
|
26
|
-
const time = "00:00:00";
|
|
27
|
-
expect(validator.formatIsValid(time)).toBe(true);
|
|
28
|
-
});
|
|
29
|
-
it("Should not accept hours over 23", () => {
|
|
30
|
-
const time = "24:00:00";
|
|
31
|
-
expect(validator.formatIsValid(time)).toBe(false);
|
|
32
|
-
});
|
|
33
|
-
it("Should not accept minutes over 59", () => {
|
|
34
|
-
const time = "00:60:00";
|
|
35
|
-
expect(validator.formatIsValid(time)).toBe(false);
|
|
36
|
-
});
|
|
37
|
-
it("Should not accept seconds over 59", () => {
|
|
38
|
-
const time = "00:00:60";
|
|
39
|
-
expect(validator.formatIsValid(time)).toBe(false);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { IClass } from "./Class";
|
|
2
|
-
import { IContract } from "./Contract";
|
|
3
|
-
import { ICourse } from "./Course";
|
|
4
|
-
import { IFile } from "./File";
|
|
5
|
-
import { IPaymentRecognitionRequest } from "./PaymentRecognitionRequest";
|
|
6
|
-
import { IPreApprovedUser } from "./PreApprovedUser";
|
|
7
|
-
import { ISchool } from "./School";
|
|
8
|
-
import { IUserAuth } from "./UserAuth";
|
|
9
|
-
export interface IPayment {
|
|
10
|
-
id: string;
|
|
11
|
-
title: string | null;
|
|
12
|
-
fileId: string | null;
|
|
13
|
-
value: number;
|
|
14
|
-
currency: string;
|
|
15
|
-
description: string | null;
|
|
16
|
-
creatorId: string | null;
|
|
17
|
-
confirmed: boolean;
|
|
18
|
-
createdAt: Date | null;
|
|
19
|
-
updatedAt: Date | null;
|
|
20
|
-
payerId: string | null;
|
|
21
|
-
payeeId: string | null;
|
|
22
|
-
schoolPayerId: string | null;
|
|
23
|
-
schoolPayeeId: string | null;
|
|
24
|
-
preApprovedUserPayerEmail: string | null;
|
|
25
|
-
payerConfirmed: boolean | null;
|
|
26
|
-
payeeConfirmed: boolean | null;
|
|
27
|
-
status: string | null;
|
|
28
|
-
courseId: string | null;
|
|
29
|
-
classId: string | null;
|
|
30
|
-
contractId: string | null;
|
|
31
|
-
dueDate: Date | null;
|
|
32
|
-
file?: IFile;
|
|
33
|
-
payer?: IUserAuth;
|
|
34
|
-
schoolPayer?: ISchool;
|
|
35
|
-
preApprovedUserPayer?: IPreApprovedUser;
|
|
36
|
-
payee?: IUserAuth;
|
|
37
|
-
schoolPayee?: ISchool;
|
|
38
|
-
course?: ICourse;
|
|
39
|
-
classes?: IClass[];
|
|
40
|
-
contract?: IContract;
|
|
41
|
-
recognitionRequests?: IPaymentRecognitionRequest[];
|
|
42
|
-
}
|
package/dist/entities/Payment.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IPayment } from "./Payment";
|
|
2
|
-
import { IUserAuth } from "./UserAuth";
|
|
3
|
-
import { ISchool } from "./School";
|
|
4
|
-
export interface IPaymentRecognitionRequest {
|
|
5
|
-
id: string;
|
|
6
|
-
paymentId: string;
|
|
7
|
-
requestedUserId: string | null;
|
|
8
|
-
requestedSchoolId: string | null;
|
|
9
|
-
payment?: IPayment;
|
|
10
|
-
requestedUser?: IUserAuth | null;
|
|
11
|
-
requestedSchool?: ISchool | null;
|
|
12
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IUserAuth } from "./UserAuth";
|
|
2
|
-
import { IPayment } from "./Payment";
|
|
3
|
-
import { IContract } from "./Contract";
|
|
4
|
-
import { ICourse } from "./Course";
|
|
5
|
-
export interface IPreApprovedUser {
|
|
6
|
-
email: string;
|
|
7
|
-
creatorId: string | null;
|
|
8
|
-
creator?: IUserAuth | null;
|
|
9
|
-
paymentsMade?: IPayment[];
|
|
10
|
-
contractsContracted?: IContract[];
|
|
11
|
-
enrolledCourses?: ICourse[];
|
|
12
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { IClass } from "./Class";
|
|
2
|
-
import { IUserAuth } from "./UserAuth";
|
|
3
|
-
import { IUserUnavailableTime } from "./UserUnavailableTime";
|
|
4
|
-
export interface IRescheduleRequest {
|
|
5
|
-
id: string;
|
|
6
|
-
isRecurrent: boolean;
|
|
7
|
-
requesterId: string;
|
|
8
|
-
targetClassId: string;
|
|
9
|
-
targetAvailableTimeId: string;
|
|
10
|
-
createdAt: Date | null;
|
|
11
|
-
requester?: IUserAuth;
|
|
12
|
-
targetClass?: IClass;
|
|
13
|
-
targetAvailableTime?: IUserUnavailableTime;
|
|
14
|
-
usersThatAccepted?: IUserAuth[];
|
|
15
|
-
usersThatDenied?: IUserAuth[];
|
|
16
|
-
}
|