@eliasrrosa/tutorhub-public-assets 0.0.1 → 0.0.2

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 (109) hide show
  1. package/dist/domain/entities/AsaasCustomer.d.ts +14 -0
  2. package/dist/domain/entities/AsaasCustomer.js +13 -0
  3. package/dist/domain/entities/Class.d.ts +79 -0
  4. package/dist/domain/entities/Class.js +30 -0
  5. package/dist/domain/entities/ClassRequest.d.ts +15 -0
  6. package/dist/domain/entities/ClassRequest.js +2 -0
  7. package/dist/domain/entities/Contract.d.ts +40 -0
  8. package/dist/domain/entities/Contract.js +2 -0
  9. package/dist/domain/entities/Course.d.ts +34 -0
  10. package/dist/domain/entities/Course.js +2 -0
  11. package/dist/domain/entities/CourseToSchoolConnectionRequest.d.ts +10 -0
  12. package/dist/domain/entities/CourseToSchoolConnectionRequest.js +2 -0
  13. package/dist/domain/entities/Date.d.ts +56 -0
  14. package/dist/domain/entities/Date.js +2 -0
  15. package/dist/domain/entities/Date.test.d.ts +0 -0
  16. package/dist/domain/entities/Date.test.js +23 -0
  17. package/dist/domain/entities/DateTimeSlot.d.ts +6 -0
  18. package/dist/domain/entities/DateTimeSlot.js +2 -0
  19. package/dist/domain/entities/DateValidator.d.ts +3 -0
  20. package/dist/domain/entities/DateValidator.js +2 -0
  21. package/dist/domain/entities/File.d.ts +23 -0
  22. package/dist/domain/entities/File.js +2 -0
  23. package/dist/domain/entities/FreeTimeSlot.d.ts +19 -0
  24. package/dist/domain/entities/FreeTimeSlot.js +12 -0
  25. package/dist/domain/entities/GenericNotification.d.ts +11 -0
  26. package/dist/domain/entities/GenericNotification.js +2 -0
  27. package/dist/domain/entities/GoogleAuth.d.ts +8 -0
  28. package/dist/domain/entities/GoogleAuth.js +2 -0
  29. package/dist/domain/entities/GoogleCalendar.d.ts +10 -0
  30. package/dist/domain/entities/GoogleCalendar.js +2 -0
  31. package/dist/domain/entities/GoogleCalendarEvent.d.ts +10 -0
  32. package/dist/domain/entities/GoogleCalendarEvent.js +2 -0
  33. package/dist/domain/entities/ISO8601Date.d.ts +35 -0
  34. package/dist/domain/entities/ISO8601Date.js +86 -0
  35. package/dist/domain/entities/ISO8601Date.test.d.ts +1 -0
  36. package/dist/domain/entities/ISO8601Date.test.js +210 -0
  37. package/dist/domain/entities/ISO8601DateTime.d.ts +41 -0
  38. package/dist/domain/entities/ISO8601DateTime.js +44 -0
  39. package/dist/domain/entities/ISO8601DateTime.test.d.ts +1 -0
  40. package/dist/domain/entities/ISO8601DateTime.test.js +146 -0
  41. package/dist/domain/entities/ISO8601DateValidator.d.ts +13 -0
  42. package/dist/domain/entities/ISO8601DateValidator.js +20 -0
  43. package/dist/domain/entities/ISO8601DateValidator.test.d.ts +1 -0
  44. package/dist/domain/entities/ISO8601DateValidator.test.js +15 -0
  45. package/dist/domain/entities/ISO8601Time.d.ts +25 -0
  46. package/dist/domain/entities/ISO8601Time.js +57 -0
  47. package/dist/domain/entities/ISO8601Time.test.d.ts +1 -0
  48. package/dist/domain/entities/ISO8601Time.test.js +63 -0
  49. package/dist/domain/entities/ISO8601TimeValidator.d.ts +12 -0
  50. package/dist/domain/entities/ISO8601TimeValidator.js +19 -0
  51. package/dist/domain/entities/ISO8601TimeValidator.test.d.ts +1 -0
  52. package/dist/domain/entities/ISO8601TimeValidator.test.js +42 -0
  53. package/dist/domain/entities/PasswordRecovery.d.ts +6 -0
  54. package/dist/domain/entities/PasswordRecovery.js +2 -0
  55. package/dist/domain/entities/Payment.d.ts +42 -0
  56. package/dist/domain/entities/Payment.js +2 -0
  57. package/dist/domain/entities/PaymentRecognitionRequest.d.ts +12 -0
  58. package/dist/domain/entities/PaymentRecognitionRequest.js +2 -0
  59. package/dist/domain/entities/PreApprovedUser.d.ts +12 -0
  60. package/dist/domain/entities/PreApprovedUser.js +2 -0
  61. package/dist/domain/entities/RescheduleRequest.d.ts +16 -0
  62. package/dist/domain/entities/RescheduleRequest.js +2 -0
  63. package/dist/domain/entities/School.d.ts +31 -0
  64. package/dist/domain/entities/School.js +2 -0
  65. package/dist/domain/entities/SchoolConnection.d.ts +10 -0
  66. package/dist/domain/entities/SchoolConnection.js +2 -0
  67. package/dist/domain/entities/SchoolConnectionRequest.d.ts +7 -0
  68. package/dist/domain/entities/SchoolConnectionRequest.js +2 -0
  69. package/dist/domain/entities/SchoolStudent.d.ts +14 -0
  70. package/dist/domain/entities/SchoolStudent.js +2 -0
  71. package/dist/domain/entities/SchoolTeacher.d.ts +14 -0
  72. package/dist/domain/entities/SchoolTeacher.js +2 -0
  73. package/dist/domain/entities/Time.d.ts +9 -0
  74. package/dist/domain/entities/Time.js +2 -0
  75. package/dist/domain/entities/TimeSlot.d.ts +4 -0
  76. package/dist/domain/entities/TimeSlot.js +2 -0
  77. package/dist/domain/entities/TimeValidator.d.ts +3 -0
  78. package/dist/domain/entities/TimeValidator.js +2 -0
  79. package/dist/domain/entities/UnauthorizedUser.d.ts +16 -0
  80. package/dist/domain/entities/UnauthorizedUser.js +2 -0
  81. package/dist/domain/entities/UserAuth.d.ts +72 -0
  82. package/dist/domain/entities/UserAuth.js +2 -0
  83. package/dist/domain/entities/UserConnection.d.ts +8 -0
  84. package/dist/domain/entities/UserConnection.js +2 -0
  85. package/dist/domain/entities/UserConnectionRequest.d.ts +9 -0
  86. package/dist/domain/entities/UserConnectionRequest.js +2 -0
  87. package/dist/domain/entities/UserCredentials.d.ts +16 -0
  88. package/dist/domain/entities/UserCredentials.js +11 -0
  89. package/dist/domain/entities/UserNavigation.d.ts +8 -0
  90. package/dist/domain/entities/UserNavigation.js +2 -0
  91. package/dist/domain/entities/UserPreferences.d.ts +6 -0
  92. package/dist/domain/entities/UserPreferences.js +2 -0
  93. package/dist/domain/entities/UserPremium.d.ts +13 -0
  94. package/dist/domain/entities/UserPremium.js +2 -0
  95. package/dist/domain/entities/UserProfile.d.ts +9 -0
  96. package/dist/domain/entities/UserProfile.js +2 -0
  97. package/dist/domain/entities/UserRoles.d.ts +11 -0
  98. package/dist/domain/entities/UserRoles.js +2 -0
  99. package/dist/domain/entities/UserSharedFileTimestamps.d.ts +9 -0
  100. package/dist/domain/entities/UserSharedFileTimestamps.js +2 -0
  101. package/dist/domain/entities/UserUnavailableTime.d.ts +49 -0
  102. package/dist/domain/entities/UserUnavailableTime.js +32 -0
  103. package/dist/domain/entities/UserUnavailableTime.test.d.ts +1 -0
  104. package/dist/domain/entities/UserUnavailableTime.test.js +22 -0
  105. package/dist/domain/repositories/UnavailableTimeRepository.d.ts +20 -0
  106. package/dist/domain/repositories/UnavailableTimeRepository.js +2 -0
  107. package/dist/restful/responses/GetFixedAvailableTimesResponseBody.d.ts +4 -0
  108. package/dist/restful/responses/GetFixedAvailableTimesResponseBody.js +2 -0
  109. package/package.json +2 -2
@@ -0,0 +1,14 @@
1
+ export declare class AsaasCustomer {
2
+ name: string;
3
+ cpfCnpj: string;
4
+ email: string;
5
+ mobilePhone: string;
6
+ externalReference?: string;
7
+ constructor(opts: {
8
+ name: string;
9
+ cpfCnpj: string;
10
+ email: string;
11
+ mobilePhone: string;
12
+ externalReference?: string;
13
+ });
14
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsaasCustomer = void 0;
4
+ class AsaasCustomer {
5
+ constructor(opts) {
6
+ this.name = opts.name;
7
+ this.cpfCnpj = opts.cpfCnpj;
8
+ this.email = opts.email;
9
+ this.mobilePhone = opts.mobilePhone;
10
+ this.externalReference = opts.externalReference;
11
+ }
12
+ }
13
+ exports.AsaasCustomer = AsaasCustomer;
@@ -0,0 +1,79 @@
1
+ import { IContract } from "./Contract";
2
+ import { ICourse } from "./Course";
3
+ import { IDate } from "./Date";
4
+ import { IFile } from "./File";
5
+ import { IGoogleCalendarEvent } from "./GoogleCalendarEvent";
6
+ import { IPayment } from "./Payment";
7
+ import { IRescheduleRequest } from "./RescheduleRequest";
8
+ export interface IClass {
9
+ id: string;
10
+ groupId: string | null;
11
+ title: string;
12
+ description: string | null;
13
+ createdAt: Date | null;
14
+ updatedAt: Date | null;
15
+ date: IDate;
16
+ time: string;
17
+ endTime: string;
18
+ endDate: IDate | null;
19
+ courseId: string;
20
+ paymentId: string | null;
21
+ status: string | null;
22
+ course?: ICourse;
23
+ payment?: IPayment;
24
+ files?: IFile[];
25
+ rescheduleRequests?: IRescheduleRequest[];
26
+ googleCalendarEvents?: IGoogleCalendarEvent[];
27
+ meetingLink: string | null;
28
+ contractId: string | null;
29
+ contract?: IContract;
30
+ ownerId: string;
31
+ }
32
+ export declare class Class implements IClass {
33
+ id: string;
34
+ groupId: string | null;
35
+ title: string;
36
+ description: string | null;
37
+ createdAt: Date | null;
38
+ updatedAt: Date | null;
39
+ date: IDate;
40
+ time: string;
41
+ endTime: string;
42
+ endDate: IDate | null;
43
+ courseId: string;
44
+ paymentId: string | null;
45
+ status: string | null;
46
+ course?: ICourse;
47
+ payment?: IPayment;
48
+ files?: IFile[];
49
+ rescheduleRequests?: IRescheduleRequest[];
50
+ googleCalendarEvents?: IGoogleCalendarEvent[];
51
+ meetingLink: string | null;
52
+ contractId: string | null;
53
+ contract?: IContract;
54
+ ownerId: string;
55
+ constructor(params: {
56
+ id: string;
57
+ groupId?: string | null;
58
+ title: string;
59
+ description?: string | null;
60
+ createdAt?: Date | null;
61
+ updatedAt?: Date | null;
62
+ date: IDate;
63
+ time: string;
64
+ endTime: string;
65
+ endDate?: IDate | null;
66
+ courseId: string;
67
+ paymentId?: string | null;
68
+ status?: string | null;
69
+ course?: ICourse;
70
+ payment?: IPayment;
71
+ files?: IFile[];
72
+ rescheduleRequests?: IRescheduleRequest[];
73
+ googleCalendarEvents?: IGoogleCalendarEvent[];
74
+ meetingLink?: string | null;
75
+ contractId?: string | null;
76
+ contract?: IContract;
77
+ ownerId: string;
78
+ });
79
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Class = void 0;
4
+ class Class {
5
+ constructor(params) {
6
+ this.id = params.id;
7
+ this.groupId = params.groupId ? params.groupId : null;
8
+ this.title = params.title;
9
+ this.description = params.description ? params.description : null;
10
+ this.createdAt = params.createdAt ? params.createdAt : null;
11
+ this.updatedAt = params.updatedAt ? params.updatedAt : null;
12
+ this.date = params.date;
13
+ this.time = params.time;
14
+ this.endTime = params.endTime;
15
+ this.endDate = params.endDate ? params.endDate : null;
16
+ this.courseId = params.courseId;
17
+ this.paymentId = params.paymentId ? params.paymentId : null;
18
+ this.status = params.status ? params.status : null;
19
+ this.course = params.course;
20
+ this.payment = params.payment;
21
+ this.files = params.files;
22
+ this.rescheduleRequests = params.rescheduleRequests;
23
+ this.googleCalendarEvents = params.googleCalendarEvents;
24
+ this.meetingLink = params.meetingLink ? params.meetingLink : null;
25
+ this.contractId = params.contractId ? params.contractId : null;
26
+ this.contract = params.contract;
27
+ this.ownerId = params.ownerId;
28
+ }
29
+ }
30
+ exports.Class = Class;
@@ -0,0 +1,15 @@
1
+ import { IUserAuth } from "./UserAuth";
2
+ import { ICourse } from "./Course";
3
+ export interface IClassRequest {
4
+ id: string;
5
+ requesterId: string;
6
+ requester?: IUserAuth;
7
+ requestedId: string;
8
+ requested?: IUserAuth;
9
+ date: Date;
10
+ startTime: string;
11
+ endTime: string;
12
+ courseId?: string;
13
+ course?: ICourse;
14
+ createdAt?: Date;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,40 @@
1
+ import { IClass } from "./Class";
2
+ import { ICourse } from "./Course";
3
+ import { IFile } from "./File";
4
+ import { IPayment } from "./Payment";
5
+ import { IPreApprovedUser } from "./PreApprovedUser";
6
+ import { ISchool } from "./School";
7
+ import { IUserAuth } from "./UserAuth";
8
+ export interface IContract {
9
+ id: string;
10
+ title: string;
11
+ contractorId: string | null;
12
+ schoolContractorId: string | null;
13
+ contractantId: string | null;
14
+ schoolContractantId: string | null;
15
+ preApprovedUserContractantEmail: string | null;
16
+ contractantSigned: boolean;
17
+ contractorSigned: boolean;
18
+ creatorId: string;
19
+ contractorSignatureDate: Date | null;
20
+ contractantSignatureDate: Date | null;
21
+ fileId: string | null;
22
+ responsibleTeacherId: string | null;
23
+ contractExpiryDate: Date | null;
24
+ status: string | null;
25
+ courseId: string | null;
26
+ createdAt: Date;
27
+ schoolId: string | null;
28
+ creator?: IUserAuth;
29
+ contractor?: IUserAuth | null;
30
+ schoolContractor?: ISchool | null;
31
+ contractant?: IUserAuth | null;
32
+ schoolContractant?: ISchool | null;
33
+ classes?: IClass[];
34
+ payments?: IPayment[];
35
+ file?: IFile | null;
36
+ responsibleTeacher?: IUserAuth | null;
37
+ course?: ICourse | null;
38
+ school?: ISchool | null;
39
+ preApprovedUserContractant?: IPreApprovedUser | null;
40
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,34 @@
1
+ import { IClass } from "./Class";
2
+ import { IClassRequest } from "./ClassRequest";
3
+ import { IContract } from "./Contract";
4
+ import { ICourseToSchoolConnectionRequest } from "./CourseToSchoolConnectionRequest";
5
+ import { IFile } from "./File";
6
+ import { IPayment } from "./Payment";
7
+ import { IPreApprovedUser } from "./PreApprovedUser";
8
+ import { ISchool } from "./School";
9
+ import { IUserAuth } from "./UserAuth";
10
+ import { IUserUnavailableTime } from "./UserUnavailableTime";
11
+ export interface ICourse {
12
+ id: string;
13
+ title: string;
14
+ description: string;
15
+ createdAt: Date | null;
16
+ updatedAt: Date | null;
17
+ isActive: boolean;
18
+ ownerId: string;
19
+ schoolId: string | null;
20
+ responsibleTeacherId: string | null;
21
+ owner?: IUserAuth;
22
+ students?: IUserAuth[];
23
+ preApprovedUserStudents?: IPreApprovedUser[];
24
+ classes?: IClass[];
25
+ payments?: IPayment[];
26
+ files?: IFile[];
27
+ availableTimes?: IUserUnavailableTime[];
28
+ classRequests?: IClassRequest[];
29
+ meetingLink: string | null;
30
+ contracts?: IContract[];
31
+ schools?: ISchool;
32
+ courseToSchoolConnectionRequests?: ICourseToSchoolConnectionRequest[];
33
+ responsibleTeacher?: IUserAuth;
34
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { ICourse } from "./Course";
2
+ import { ISchool } from "./School";
3
+ export interface ICourseToSchoolConnectionRequest {
4
+ courseId: string;
5
+ schoolId: string;
6
+ requesterId: string;
7
+ createdAt: Date;
8
+ course?: ICourse;
9
+ school?: ISchool;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,56 @@
1
+ /**An utility to separate dates from times. Operate on dates
2
+ * by clearly chosing between local time and utc, and without the nuances
3
+ * of hours, minutes and seconds.
4
+ */
5
+ export interface IDate {
6
+ /**
7
+ * a string like formatted like YYYY-MM-DD (eg. '1920-01-02', '2025-12-30') representing a date.
8
+ */
9
+ value: string;
10
+ /**
11
+ * @returns a string like formatted like DD (eg. '03', '21') representing the day.
12
+ */
13
+ getDay: () => string;
14
+ /**
15
+ * @returns a string like formatted like MM (eg. '03', '12') representing the month.
16
+ */
17
+ getMonth: () => string;
18
+ /**
19
+ * @returns a string like formatted like YYYY (eg. '1920', '2025') representing the year.
20
+ */
21
+ getYear: () => string;
22
+ /**
23
+ * @returns a string like formatted like YYYY-MM-DD (eg. '1920-01-02', '2025-12-30') representing the today's date,
24
+ * in the system's timezone.
25
+ */
26
+ getToday: () => string;
27
+ /**
28
+ * Returns a new instance of IDate with the days added.
29
+ * Counts for added months and years.
30
+ */
31
+ addDays: (daysToAdd: number) => IDate;
32
+ /**
33
+ * Converts a Javascript Date instance into an IDate instance. Uses local timezone as default.
34
+ * @param useUtc set to true to consider UTC when extracting year, month and date
35
+ * @returns a new IDate instance.
36
+ */
37
+ jsDateTimeToDate: (dateTime: Date, opts?: {
38
+ useUtc?: boolean;
39
+ }) => IDate;
40
+ /**
41
+ * Returns `date` or `this.date` as a Javascript Date object.
42
+ * Considers `date` or `this.date` as local time, with hours, minutes
43
+ * and seconds set to 0.
44
+ */
45
+ toLocalJsDateTime: (date?: IDate) => Date;
46
+ /**
47
+ * Returns `date` or `this.date` as a Javascript Date object.
48
+ * Considers `date` or `this.date` as utc time, with hours, minutes
49
+ * and seconds set to 0.
50
+ */
51
+ readonly toUtcJsDateTime: (date?: IDate) => Date;
52
+ /**Returns the time elapsed in days since the epoch (1970-01-01 00:00:00 UTC)
53
+ * up to `this.value` or `date` param if specified. */
54
+ readonly getDaysSinceEpoch: (date?: IDate) => number;
55
+ readonly getDayOfTheWeek: (date?: IDate) => number;
56
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
File without changes
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ describe("Date", () => {
3
+ describe("Date.getDate()", () => {
4
+ it("Should return the same date if instantiated with timezone.", () => {
5
+ const date = new Date("2025-01-01T00:00:00-03:00");
6
+ expect(date.getDate()).toBe(1);
7
+ });
8
+ it("Should return same date if instantiated with numbers", () => {
9
+ const date = new Date(2025, 1, 1);
10
+ expect(date.getDate()).toBe(1);
11
+ });
12
+ it("Should return incorrect date if instantiated with string.", () => {
13
+ const date = new Date("2025-01-01");
14
+ expect(date.getDate()).toBe(31);
15
+ });
16
+ });
17
+ describe("Date.getTimezoneOffset().toLocaleString()", () => {
18
+ it("Should return brazilian timezone offset.", () => {
19
+ const date = new Date("2025-01-01");
20
+ expect(date.getTimezoneOffset()).toBe(180);
21
+ });
22
+ });
23
+ });
@@ -0,0 +1,6 @@
1
+ import { IDate } from "./Date";
2
+ import { ITimeSlot } from "./TimeSlot";
3
+ export interface IDateTimeSlot {
4
+ timeSlot: ITimeSlot;
5
+ date: IDate;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface IDateValidator {
2
+ formatIsValid: (date: string) => boolean;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,23 @@
1
+ import { IClass } from "./Class";
2
+ import { IContract } from "./Contract";
3
+ import { ICourse } from "./Course";
4
+ import { IPayment } from "./Payment";
5
+ import { IUserAuth } from "./UserAuth";
6
+ import { IUserSharedFileTimestamps } from "./UserSharedFileTimestamps";
7
+ export interface IFile {
8
+ id: string;
9
+ name: string;
10
+ type: string;
11
+ ownerId: string;
12
+ privacy: string;
13
+ createdAt: Date | null;
14
+ updatedAt: Date | null;
15
+ downloadCount: number;
16
+ owner?: IUserAuth;
17
+ viewers?: IUserAuth[];
18
+ courses?: ICourse[];
19
+ classes?: IClass[];
20
+ payments?: IPayment[];
21
+ userSharedFileTimestamps?: IUserSharedFileTimestamps[];
22
+ contract?: IContract;
23
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ import { IDate } from "./Date";
2
+ export interface IFreeDateTimeSlot {
3
+ date: IDate;
4
+ startTime: string;
5
+ endTime: string;
6
+ userId: string;
7
+ }
8
+ export declare class FreeDateTimeSlot implements IFreeDateTimeSlot {
9
+ date: IDate;
10
+ startTime: string;
11
+ endTime: string;
12
+ userId: string;
13
+ constructor(opts: {
14
+ date: IDate;
15
+ startTime: string;
16
+ endTime: string;
17
+ userId: string;
18
+ });
19
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FreeDateTimeSlot = void 0;
4
+ class FreeDateTimeSlot {
5
+ constructor(opts) {
6
+ this.date = opts.date;
7
+ this.startTime = opts.startTime;
8
+ this.endTime = opts.endTime;
9
+ this.userId = opts.userId;
10
+ }
11
+ }
12
+ exports.FreeDateTimeSlot = FreeDateTimeSlot;
@@ -0,0 +1,11 @@
1
+ import { IUserAuth } from "./UserAuth";
2
+ export interface IGenericNotification {
3
+ id: string;
4
+ text: string;
5
+ senderId: string | null;
6
+ sender?: IUserAuth | null;
7
+ receivers?: IUserAuth[];
8
+ createdAt: Date | null;
9
+ usersThatSeen?: IUserAuth[];
10
+ link: string | null;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { IUserAuth } from "./UserAuth";
2
+ export interface IGoogleAuth {
3
+ user?: IUserAuth;
4
+ userId: string;
5
+ accessToken: string;
6
+ refreshToken: string;
7
+ updatedAt: Date;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { IUserAuth } from "./UserAuth";
2
+ import { IGoogleCalendarEvent } from "./GoogleCalendarEvent";
3
+ export interface IGoogleCalendar {
4
+ userId: string;
5
+ calendarId: string;
6
+ createdAt: Date;
7
+ isSynched: boolean;
8
+ user?: IUserAuth;
9
+ events?: IGoogleCalendarEvent[];
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { IClass } from "./Class";
2
+ import { IGoogleCalendar } from "./GoogleCalendar";
3
+ export interface IGoogleCalendarEvent {
4
+ calendarId: string;
5
+ classId: string;
6
+ eventId: string;
7
+ updatedAt: Date;
8
+ calendar?: IGoogleCalendar;
9
+ class?: IClass;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,35 @@
1
+ import { IDate } from "./Date";
2
+ import { IDateValidator } from "./DateValidator";
3
+ export declare class ISO8601Date implements IDate {
4
+ readonly value: string;
5
+ validator: IDateValidator;
6
+ constructor(value?: string);
7
+ private throwIfFormatIsNotValid;
8
+ getDay: () => string;
9
+ getMonth: () => string;
10
+ getYear: () => string;
11
+ /**
12
+ * @returns today's date as a string, in local time, formatted like YYYY-MM-DD.
13
+ */
14
+ static getToday(): string;
15
+ /**
16
+ * @returns today's date as a srting, in local time, formatted like YYYY-MM-DD.
17
+ */
18
+ getToday: typeof ISO8601Date.getToday;
19
+ addDays: (x: number) => IDate;
20
+ /**
21
+ * Converts a Javascript Date instance into an IDate instance. Uses local timezone as default.
22
+ * @param useUtc set to `true` to consider UTC when extracting year, month and date
23
+ * @returns a new `ISO8601Date` instance.
24
+ */
25
+ static jsDateTimeToDate: (dateTime: Date, opts?: {
26
+ useUtc?: boolean;
27
+ }) => IDate;
28
+ jsDateTimeToDate: (dateTime: Date, opts?: {
29
+ useUtc?: boolean;
30
+ }) => IDate;
31
+ toLocalJsDateTime: (date?: IDate) => Date;
32
+ getDaysSinceEpoch: (date?: IDate) => number;
33
+ readonly toUtcJsDateTime: (date?: IDate) => Date;
34
+ readonly getDayOfTheWeek: (date?: IDate) => number;
35
+ }
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ISO8601Date = void 0;
4
+ const ISO8601DateValidator_1 = require("./ISO8601DateValidator");
5
+ class ISO8601Date {
6
+ constructor(value) {
7
+ this.validator = new ISO8601DateValidator_1.ISO8601DateValidator();
8
+ this.getDay = () => {
9
+ this.throwIfFormatIsNotValid();
10
+ return this.value.split("-")[2];
11
+ };
12
+ this.getMonth = () => {
13
+ this.throwIfFormatIsNotValid();
14
+ return this.value.split("-")[1];
15
+ };
16
+ this.getYear = () => {
17
+ this.throwIfFormatIsNotValid();
18
+ return this.value.split("-")[0];
19
+ };
20
+ /**
21
+ * @returns today's date as a srting, in local time, formatted like YYYY-MM-DD.
22
+ */
23
+ this.getToday = ISO8601Date.getToday;
24
+ this.addDays = (x) => {
25
+ const now = new Date(parseInt(this.getYear()), parseInt(this.getMonth()) - 1, parseInt(this.getDay()));
26
+ const day = now.getDate() + x;
27
+ const newDate = new Date(now.getFullYear(), now.getMonth(), day);
28
+ return new ISO8601Date(this.jsDateTimeToDate(newDate).value);
29
+ };
30
+ this.jsDateTimeToDate = ISO8601Date.jsDateTimeToDate;
31
+ this.toLocalJsDateTime = (date) => {
32
+ const targetDate = date ? date : this;
33
+ return new Date(parseInt(targetDate.getYear()), parseInt(targetDate.getMonth()) - 1, parseInt(targetDate.getDay()));
34
+ };
35
+ this.getDaysSinceEpoch = (date) => {
36
+ const targetDate = date || this;
37
+ const differenceInDays = Math.floor(targetDate.toLocalJsDateTime(targetDate).getTime() / 1000 / 60 / 60 / 24);
38
+ return differenceInDays;
39
+ };
40
+ this.toUtcJsDateTime = (date) => {
41
+ const targetDate = date ? date : this;
42
+ const year = targetDate.getYear();
43
+ const month = targetDate.getMonth();
44
+ const day = targetDate.getDay();
45
+ const dateString = `${year}-${month}-${day}T00:00:00.000Z`;
46
+ return new Date(dateString);
47
+ };
48
+ this.getDayOfTheWeek = (date) => {
49
+ const targetDate = date || this;
50
+ return targetDate.toUtcJsDateTime().getUTCDay();
51
+ };
52
+ this.value = value ? value : this.getToday();
53
+ this.throwIfFormatIsNotValid();
54
+ }
55
+ throwIfFormatIsNotValid() {
56
+ if (!this.validator.formatIsValid(this.value)) {
57
+ throw new Error("Date format must be YYYY-MM-DD.");
58
+ }
59
+ }
60
+ /**
61
+ * @returns today's date as a string, in local time, formatted like YYYY-MM-DD.
62
+ */
63
+ static getToday() {
64
+ const now = new Date();
65
+ const day = now.getDate().toString().padStart(2, "0");
66
+ const month = (now.getMonth() + 1).toString().padStart(2, "0");
67
+ const year = now.getFullYear().toString();
68
+ return `${year}-${month}-${day}`;
69
+ }
70
+ }
71
+ exports.ISO8601Date = ISO8601Date;
72
+ /**
73
+ * Converts a Javascript Date instance into an IDate instance. Uses local timezone as default.
74
+ * @param useUtc set to `true` to consider UTC when extracting year, month and date
75
+ * @returns a new `ISO8601Date` instance.
76
+ */
77
+ ISO8601Date.jsDateTimeToDate = (dateTime, opts) => {
78
+ const day = ((opts === null || opts === void 0 ? void 0 : opts.useUtc) ? dateTime.getUTCDate() : dateTime.getDate())
79
+ .toString()
80
+ .padStart(2, "0");
81
+ const month = ((opts === null || opts === void 0 ? void 0 : opts.useUtc) ? dateTime.getUTCMonth() + 1 : dateTime.getMonth() + 1)
82
+ .toString()
83
+ .padStart(2, "0");
84
+ const year = ((opts === null || opts === void 0 ? void 0 : opts.useUtc) ? dateTime.getUTCFullYear() : dateTime.getFullYear()).toString();
85
+ return new ISO8601Date(`${year}-${month}-${day}`);
86
+ };
@@ -0,0 +1 @@
1
+ export {};