@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
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AsaasCustomer: () => AsaasCustomer,
|
|
24
|
+
Class: () => Class,
|
|
25
|
+
FreeDateTimeSlot: () => FreeDateTimeSlot,
|
|
26
|
+
ISO8601Date: () => ISO8601Date,
|
|
27
|
+
ISO8601DateTime: () => ISO8601DateTime,
|
|
28
|
+
ISO8601DateValidator: () => ISO8601DateValidator,
|
|
29
|
+
ISO8601Time: () => ISO8601Time,
|
|
30
|
+
ISO8601TimeValidator: () => ISO8601TimeValidator,
|
|
31
|
+
UserUnavailableTime: () => UserUnavailableTime
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(index_exports);
|
|
34
|
+
|
|
35
|
+
// src/domain/entities/AsaasCustomer.ts
|
|
36
|
+
var AsaasCustomer = class {
|
|
37
|
+
constructor(opts) {
|
|
38
|
+
this.name = opts.name;
|
|
39
|
+
this.cpfCnpj = opts.cpfCnpj;
|
|
40
|
+
this.email = opts.email;
|
|
41
|
+
this.mobilePhone = opts.mobilePhone;
|
|
42
|
+
this.externalReference = opts.externalReference;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// src/domain/entities/Class.ts
|
|
47
|
+
var Class = class {
|
|
48
|
+
constructor(params) {
|
|
49
|
+
this.id = params.id;
|
|
50
|
+
this.groupId = params.groupId ? params.groupId : null;
|
|
51
|
+
this.title = params.title;
|
|
52
|
+
this.description = params.description ? params.description : null;
|
|
53
|
+
this.createdAt = params.createdAt ? params.createdAt : null;
|
|
54
|
+
this.updatedAt = params.updatedAt ? params.updatedAt : null;
|
|
55
|
+
this.date = params.date;
|
|
56
|
+
this.time = params.time;
|
|
57
|
+
this.endTime = params.endTime;
|
|
58
|
+
this.endDate = params.endDate ? params.endDate : null;
|
|
59
|
+
this.courseId = params.courseId;
|
|
60
|
+
this.paymentId = params.paymentId ? params.paymentId : null;
|
|
61
|
+
this.status = params.status ? params.status : null;
|
|
62
|
+
this.course = params.course;
|
|
63
|
+
this.payment = params.payment;
|
|
64
|
+
this.files = params.files;
|
|
65
|
+
this.rescheduleRequests = params.rescheduleRequests;
|
|
66
|
+
this.googleCalendarEvents = params.googleCalendarEvents;
|
|
67
|
+
this.meetingLink = params.meetingLink ? params.meetingLink : null;
|
|
68
|
+
this.contractId = params.contractId ? params.contractId : null;
|
|
69
|
+
this.contract = params.contract;
|
|
70
|
+
this.ownerId = params.ownerId;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// src/domain/entities/ISO8601DateValidator.ts
|
|
75
|
+
var ISO8601DateValidator = class {
|
|
76
|
+
constructor() {
|
|
77
|
+
this.YYYYmmDD = new RegExp(
|
|
78
|
+
"^[0-9]{4}-([0][1-9]|[1][0-2])-([0][1-9]|[1-2][0-9]|[3][0-1])$"
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Accepted format: YYYY-MM-DD
|
|
83
|
+
*/
|
|
84
|
+
formatIsValid(date) {
|
|
85
|
+
return this.YYYYmmDD.test(date);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// src/domain/entities/ISO8601Date.ts
|
|
90
|
+
var _ISO8601Date = class _ISO8601Date {
|
|
91
|
+
constructor(value) {
|
|
92
|
+
this.validator = new ISO8601DateValidator();
|
|
93
|
+
this.getDay = () => {
|
|
94
|
+
this.throwIfFormatIsNotValid();
|
|
95
|
+
return this.value.split("-")[2];
|
|
96
|
+
};
|
|
97
|
+
this.getMonth = () => {
|
|
98
|
+
this.throwIfFormatIsNotValid();
|
|
99
|
+
return this.value.split("-")[1];
|
|
100
|
+
};
|
|
101
|
+
this.getYear = () => {
|
|
102
|
+
this.throwIfFormatIsNotValid();
|
|
103
|
+
return this.value.split("-")[0];
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* @returns today's date as a srting, in local time, formatted like YYYY-MM-DD.
|
|
107
|
+
*/
|
|
108
|
+
this.getToday = _ISO8601Date.getToday;
|
|
109
|
+
this.addDays = (x) => {
|
|
110
|
+
const now = new Date(
|
|
111
|
+
parseInt(this.getYear()),
|
|
112
|
+
parseInt(this.getMonth()) - 1,
|
|
113
|
+
parseInt(this.getDay())
|
|
114
|
+
);
|
|
115
|
+
const day = now.getDate() + x;
|
|
116
|
+
const newDate = new Date(now.getFullYear(), now.getMonth(), day);
|
|
117
|
+
return new _ISO8601Date(this.jsDateTimeToDate(newDate).value);
|
|
118
|
+
};
|
|
119
|
+
this.jsDateTimeToDate = _ISO8601Date.jsDateTimeToDate;
|
|
120
|
+
this.toLocalJsDateTime = (date) => {
|
|
121
|
+
const targetDate = date ? date : this;
|
|
122
|
+
return new Date(
|
|
123
|
+
parseInt(targetDate.getYear()),
|
|
124
|
+
parseInt(targetDate.getMonth()) - 1,
|
|
125
|
+
parseInt(targetDate.getDay())
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
this.getDaysSinceEpoch = (date) => {
|
|
129
|
+
const targetDate = date || this;
|
|
130
|
+
const differenceInDays = Math.floor(
|
|
131
|
+
targetDate.toLocalJsDateTime(targetDate).getTime() / 1e3 / 60 / 60 / 24
|
|
132
|
+
);
|
|
133
|
+
return differenceInDays;
|
|
134
|
+
};
|
|
135
|
+
this.toUtcJsDateTime = (date) => {
|
|
136
|
+
const targetDate = date ? date : this;
|
|
137
|
+
const year = targetDate.getYear();
|
|
138
|
+
const month = targetDate.getMonth();
|
|
139
|
+
const day = targetDate.getDay();
|
|
140
|
+
const dateString = `${year}-${month}-${day}T00:00:00.000Z`;
|
|
141
|
+
return new Date(dateString);
|
|
142
|
+
};
|
|
143
|
+
this.getDayOfTheWeek = (date) => {
|
|
144
|
+
const targetDate = date || this;
|
|
145
|
+
return targetDate.toUtcJsDateTime().getUTCDay();
|
|
146
|
+
};
|
|
147
|
+
this.value = value ? value : this.getToday();
|
|
148
|
+
this.throwIfFormatIsNotValid();
|
|
149
|
+
}
|
|
150
|
+
throwIfFormatIsNotValid() {
|
|
151
|
+
if (!this.validator.formatIsValid(this.value)) {
|
|
152
|
+
throw new Error("Date format must be YYYY-MM-DD.");
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* @returns today's date as a string, in local time, formatted like YYYY-MM-DD.
|
|
157
|
+
*/
|
|
158
|
+
static getToday() {
|
|
159
|
+
const now = /* @__PURE__ */ new Date();
|
|
160
|
+
const day = now.getDate().toString().padStart(2, "0");
|
|
161
|
+
const month = (now.getMonth() + 1).toString().padStart(2, "0");
|
|
162
|
+
const year = now.getFullYear().toString();
|
|
163
|
+
return `${year}-${month}-${day}`;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Converts a Javascript Date instance into an IDate instance. Uses local timezone as default.
|
|
168
|
+
* @param useUtc set to `true` to consider UTC when extracting year, month and date
|
|
169
|
+
* @returns a new `ISO8601Date` instance.
|
|
170
|
+
*/
|
|
171
|
+
_ISO8601Date.jsDateTimeToDate = (dateTime, opts) => {
|
|
172
|
+
const day = ((opts == null ? void 0 : opts.useUtc) ? dateTime.getUTCDate() : dateTime.getDate()).toString().padStart(2, "0");
|
|
173
|
+
const month = ((opts == null ? void 0 : opts.useUtc) ? dateTime.getUTCMonth() + 1 : dateTime.getMonth() + 1).toString().padStart(2, "0");
|
|
174
|
+
const year = ((opts == null ? void 0 : opts.useUtc) ? dateTime.getUTCFullYear() : dateTime.getFullYear()).toString();
|
|
175
|
+
return new _ISO8601Date(`${year}-${month}-${day}`);
|
|
176
|
+
};
|
|
177
|
+
var ISO8601Date = _ISO8601Date;
|
|
178
|
+
|
|
179
|
+
// src/domain/entities/ISO8601DateTime.ts
|
|
180
|
+
var ISO8601DateTime = class _ISO8601DateTime {
|
|
181
|
+
constructor(opts) {
|
|
182
|
+
this.getJSDateTime = () => {
|
|
183
|
+
return new Date(
|
|
184
|
+
parseInt(this.date.getYear()),
|
|
185
|
+
parseInt(this.date.getMonth()) - 1,
|
|
186
|
+
parseInt(this.date.getDay()),
|
|
187
|
+
parseInt(this.time.getHours()),
|
|
188
|
+
parseInt(this.time.getMinutes()),
|
|
189
|
+
parseInt(this.time.getSeconds())
|
|
190
|
+
);
|
|
191
|
+
};
|
|
192
|
+
this.getBrazilianIsoString = () => {
|
|
193
|
+
return this.getIsoString({
|
|
194
|
+
timezoneOffsetMinutes: -180
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
this.date = opts.date;
|
|
198
|
+
this.time = opts.time;
|
|
199
|
+
}
|
|
200
|
+
getIsoString(opts) {
|
|
201
|
+
const padLeft = (n) => String(n).padStart(2, "0");
|
|
202
|
+
const newDateTime = new _ISO8601DateTime({
|
|
203
|
+
date: (opts == null ? void 0 : opts.newDate) || this.date,
|
|
204
|
+
time: (opts == null ? void 0 : opts.newTime) || this.time
|
|
205
|
+
});
|
|
206
|
+
const jsDate = newDateTime.getJSDateTime();
|
|
207
|
+
const year = jsDate.getFullYear();
|
|
208
|
+
const month = padLeft(jsDate.getMonth() + 1);
|
|
209
|
+
const day = padLeft(jsDate.getDate());
|
|
210
|
+
const hour = padLeft(jsDate.getHours());
|
|
211
|
+
const minute = padLeft(jsDate.getMinutes());
|
|
212
|
+
const second = padLeft(jsDate.getSeconds());
|
|
213
|
+
const timezoneOffsetMinutes = (opts == null ? void 0 : opts.timezoneOffsetMinutes) ? opts.timezoneOffsetMinutes : 0;
|
|
214
|
+
const sign = timezoneOffsetMinutes == 0 ? void 0 : timezoneOffsetMinutes < 0 ? "-" : "+";
|
|
215
|
+
const offsetHours = padLeft(
|
|
216
|
+
Math.floor(Math.abs(timezoneOffsetMinutes) / 60)
|
|
217
|
+
);
|
|
218
|
+
const offsetMinutes = padLeft(Math.abs(timezoneOffsetMinutes) % 60);
|
|
219
|
+
const timezone = sign ? `${sign}${offsetHours}:${offsetMinutes}` : ".000Z";
|
|
220
|
+
return `${year}-${month}-${day}T${hour}:${minute}:${second}${timezone}`;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// src/domain/entities/ISO8601TimeValidator.ts
|
|
225
|
+
var ISO8601TimeValidator = class {
|
|
226
|
+
constructor() {
|
|
227
|
+
this.hhMMssPattern = new RegExp(
|
|
228
|
+
"^([0-1][0-9]|[2][0-3]):[0-5][0-9]:[0-5][0-9]$"
|
|
229
|
+
);
|
|
230
|
+
this.hhMMPattern = new RegExp(
|
|
231
|
+
"^([0-1][0-9]|[2][0-3]):[0-5][0-9]$"
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
formatIsValid(time) {
|
|
235
|
+
return this.isHHmm(time) || this.isHHmmSS(time);
|
|
236
|
+
}
|
|
237
|
+
isHHmmSS(time) {
|
|
238
|
+
return this.hhMMssPattern.test(time);
|
|
239
|
+
}
|
|
240
|
+
isHHmm(time) {
|
|
241
|
+
return this.hhMMPattern.test(time);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
// src/domain/entities/ISO8601Time.ts
|
|
246
|
+
var ISO8601Time = class _ISO8601Time {
|
|
247
|
+
/**
|
|
248
|
+
* Throws if format is invalid.
|
|
249
|
+
* Accepted formats: HH:MM:SS and HH:MM.
|
|
250
|
+
*/
|
|
251
|
+
constructor(value) {
|
|
252
|
+
this.validator = new ISO8601TimeValidator();
|
|
253
|
+
this.getNow = _ISO8601Time.getNow;
|
|
254
|
+
this.value = value ? value : this.getNow();
|
|
255
|
+
this.validateFormatOrThrow();
|
|
256
|
+
}
|
|
257
|
+
validateFormatOrThrow() {
|
|
258
|
+
if (!this.validator.formatIsValid(this.value))
|
|
259
|
+
throw new Error("Time format must be ISO8601.");
|
|
260
|
+
}
|
|
261
|
+
getTime() {
|
|
262
|
+
this.validateFormatOrThrow();
|
|
263
|
+
if (this.validator.isHHmm(this.value)) {
|
|
264
|
+
return `${this.value}:00`;
|
|
265
|
+
}
|
|
266
|
+
return this.value;
|
|
267
|
+
}
|
|
268
|
+
getMinutes() {
|
|
269
|
+
this.validateFormatOrThrow();
|
|
270
|
+
return this.value.split(":")[1];
|
|
271
|
+
}
|
|
272
|
+
getHours() {
|
|
273
|
+
this.validateFormatOrThrow();
|
|
274
|
+
return this.value.split(":")[0];
|
|
275
|
+
}
|
|
276
|
+
getSeconds() {
|
|
277
|
+
this.validateFormatOrThrow();
|
|
278
|
+
const seconds = this.value.split(":")[2];
|
|
279
|
+
if (seconds) return seconds;
|
|
280
|
+
return "00";
|
|
281
|
+
}
|
|
282
|
+
static getNow() {
|
|
283
|
+
const nowDate = /* @__PURE__ */ new Date();
|
|
284
|
+
const hours = nowDate.getHours().toString().padStart(2, "0");
|
|
285
|
+
const minutes = nowDate.getMinutes().toString().padStart(2, "0");
|
|
286
|
+
const seconds = nowDate.getSeconds().toString().padStart(2, "0");
|
|
287
|
+
return `${hours}:${minutes}:${seconds}`;
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// src/domain/entities/UserUnavailableTime.ts
|
|
292
|
+
var UserUnavailableTime = class {
|
|
293
|
+
constructor(opts) {
|
|
294
|
+
this.getDateTimeSlot = () => {
|
|
295
|
+
return {
|
|
296
|
+
date: this.date,
|
|
297
|
+
timeSlot: {
|
|
298
|
+
endTime: this.endTime,
|
|
299
|
+
startTime: this.startTime
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
this.id = opts.id;
|
|
304
|
+
this.userId = opts.userId;
|
|
305
|
+
this.user = opts.user;
|
|
306
|
+
this.groupId = opts.groupId;
|
|
307
|
+
this.date = opts.date;
|
|
308
|
+
this.dayOfTheWeek = this.getDayOfTheWeek();
|
|
309
|
+
this.startTime = opts.startTime;
|
|
310
|
+
this.endTime = opts.endTime;
|
|
311
|
+
this.isAvailableTime = opts.isAvailableTime;
|
|
312
|
+
this.course = opts.course;
|
|
313
|
+
this.courseId = opts.courseId;
|
|
314
|
+
this.rescheduleRequests = opts.rescheduleRequests;
|
|
315
|
+
}
|
|
316
|
+
getDayOfTheWeek() {
|
|
317
|
+
return this.date.getDayOfTheWeek();
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
// src/domain/entities/FreeTimeSlot.ts
|
|
322
|
+
var FreeDateTimeSlot = class {
|
|
323
|
+
constructor(opts) {
|
|
324
|
+
this.date = opts.date;
|
|
325
|
+
this.startTime = opts.startTime;
|
|
326
|
+
this.endTime = opts.endTime;
|
|
327
|
+
this.userId = opts.userId;
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
331
|
+
0 && (module.exports = {
|
|
332
|
+
AsaasCustomer,
|
|
333
|
+
Class,
|
|
334
|
+
FreeDateTimeSlot,
|
|
335
|
+
ISO8601Date,
|
|
336
|
+
ISO8601DateTime,
|
|
337
|
+
ISO8601DateValidator,
|
|
338
|
+
ISO8601Time,
|
|
339
|
+
ISO8601TimeValidator,
|
|
340
|
+
UserUnavailableTime
|
|
341
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AsaasCustomer } from "./domain/entities/AsaasCustomer.js";
|
|
2
|
+
import { Class, IClass } from "./domain/entities/Class.js";
|
|
3
|
+
import { IClassRequest } from "./domain/entities/ClassRequest.js";
|
|
4
|
+
import { IContract } from "./domain/entities/Contract.js";
|
|
5
|
+
import { ICourse } from "./domain/entities/Course.js";
|
|
6
|
+
import { ICourseToSchoolConnectionRequest } from "./domain/entities/CourseToSchoolConnectionRequest.js";
|
|
7
|
+
import { IDate } from "./domain/entities/Date.js";
|
|
8
|
+
import { IDateTimeSlot } from "./domain/entities/DateTimeSlot.js";
|
|
9
|
+
import { IDateValidator } from "./domain/entities/DateValidator.js";
|
|
10
|
+
import { IFile } from "./domain/entities/File.js";
|
|
11
|
+
import { IGenericNotification } from "./domain/entities/GenericNotification.js";
|
|
12
|
+
import { IGoogleAuth } from "./domain/entities/GoogleAuth.js";
|
|
13
|
+
import { IGoogleCalendar } from "./domain/entities/GoogleCalendar.js";
|
|
14
|
+
import { IGoogleCalendarEvent } from "./domain/entities/GoogleCalendarEvent.js";
|
|
15
|
+
import { ISO8601Date } from "./domain/entities/ISO8601Date.js";
|
|
16
|
+
import { IDateTime, ISO8601DateTime } from "./domain/entities/ISO8601DateTime.js";
|
|
17
|
+
import { ISO8601DateValidator } from "./domain/entities/ISO8601DateValidator.js";
|
|
18
|
+
import { ISO8601Time } from "./domain/entities/ISO8601Time.js";
|
|
19
|
+
import { ISO8601TimeValidator } from "./domain/entities/ISO8601TimeValidator.js";
|
|
20
|
+
import { IPasswordRecovery } from "./domain/entities/PasswordRecovery.js";
|
|
21
|
+
import { IPayment } from "./domain/entities/Payment.js";
|
|
22
|
+
import { IPaymentRecognitionRequest } from "./domain/entities/PaymentRecognitionRequest.js";
|
|
23
|
+
import { IPreApprovedUser } from "./domain/entities/PreApprovedUser.js";
|
|
24
|
+
import { IRescheduleRequest } from "./domain/entities/RescheduleRequest.js";
|
|
25
|
+
import { ISchool } from "./domain/entities/School.js";
|
|
26
|
+
import { ISchoolConnection } from "./domain/entities/SchoolConnection.js";
|
|
27
|
+
import { ISchoolConnectionRequest } from "./domain/entities/SchoolConnectionRequest.js";
|
|
28
|
+
import { ISchoolStudent } from "./domain/entities/SchoolStudent.js";
|
|
29
|
+
import { ISchoolTeacher } from "./domain/entities/SchoolTeacher.js";
|
|
30
|
+
import { ITime } from "./domain/entities/Time.js";
|
|
31
|
+
import { ITimeSlot } from "./domain/entities/TimeSlot.js";
|
|
32
|
+
import { ITimeValidator } from "./domain/entities/TimeValidator.js";
|
|
33
|
+
import { IUnauthorizedUser } from "./domain/entities/UnauthorizedUser.js";
|
|
34
|
+
import { IUserAuth } from "./domain/entities/UserAuth.js";
|
|
35
|
+
import { IUserConnection } from "./domain/entities/UserConnection.js";
|
|
36
|
+
import { IUserConnectionRequest } from "./domain/entities/UserConnectionRequest.js";
|
|
37
|
+
import { IUserCredentials } from "./domain/entities/UserCredentials.js";
|
|
38
|
+
import { IUserNavigation } from "./domain/entities/UserNavigation.js";
|
|
39
|
+
import { IUserPreferences } from "./domain/entities/UserPreferences.js";
|
|
40
|
+
import { IUserPremium } from "./domain/entities/UserPremium.js";
|
|
41
|
+
import { IUserProfile } from "./domain/entities/UserProfile.js";
|
|
42
|
+
import { IUserRoles } from "./domain/entities/UserRoles.js";
|
|
43
|
+
import { IUserSharedFileTimestamps } from "./domain/entities/UserSharedFileTimestamps.js";
|
|
44
|
+
import { IUnavailableTimeRepository } from "./domain/repositories/UnavailableTimeRepository.js";
|
|
45
|
+
import { GetFixedAvailableTimeResponseBody } from "./restful/responses/GetFixedAvailableTimesResponseBody.js";
|
|
46
|
+
import { IUserUnavailableTime, UserUnavailableTime } from "./domain/entities/UserUnavailableTime.js";
|
|
47
|
+
import { IFreeDateTimeSlot, FreeDateTimeSlot } from "./domain/entities/FreeTimeSlot.js";
|
|
48
|
+
export { AsaasCustomer, Class, IClass, IClassRequest, IContract, ICourse, ICourseToSchoolConnectionRequest, IDate, IDateTimeSlot, IFreeDateTimeSlot, FreeDateTimeSlot, IUserUnavailableTime, UserUnavailableTime, IDateValidator, IFile, IGenericNotification, IGoogleAuth, IGoogleCalendar, IGoogleCalendarEvent, ISO8601Date, IDateTime, ISO8601DateValidator, ISO8601Time, ISO8601TimeValidator, IPasswordRecovery, IPayment, IPaymentRecognitionRequest, IPreApprovedUser, IRescheduleRequest, ISchool, ISchoolConnection, ISchoolConnectionRequest, ISchoolStudent, ISchoolTeacher, ITime, ITimeSlot, ITimeValidator, IUnauthorizedUser, IUserAuth, IUserConnection, IUserConnectionRequest, IUserCredentials, IUserNavigation, IUserPreferences, IUserPremium, IUserProfile, IUserRoles, IUserSharedFileTimestamps, IUnavailableTimeRepository, GetFixedAvailableTimeResponseBody, ISO8601DateTime };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ISO8601DateTime = exports.ISO8601TimeValidator = exports.ISO8601Time = exports.ISO8601DateValidator = exports.ISO8601Date = exports.UserUnavailableTime = exports.FreeDateTimeSlot = exports.Class = exports.AsaasCustomer = void 0;
|
|
4
|
+
const AsaasCustomer_js_1 = require("./domain/entities/AsaasCustomer.js");
|
|
5
|
+
Object.defineProperty(exports, "AsaasCustomer", { enumerable: true, get: function () { return AsaasCustomer_js_1.AsaasCustomer; } });
|
|
6
|
+
const Class_js_1 = require("./domain/entities/Class.js");
|
|
7
|
+
Object.defineProperty(exports, "Class", { enumerable: true, get: function () { return Class_js_1.Class; } });
|
|
8
|
+
const ISO8601Date_js_1 = require("./domain/entities/ISO8601Date.js");
|
|
9
|
+
Object.defineProperty(exports, "ISO8601Date", { enumerable: true, get: function () { return ISO8601Date_js_1.ISO8601Date; } });
|
|
10
|
+
const ISO8601DateTime_js_1 = require("./domain/entities/ISO8601DateTime.js");
|
|
11
|
+
Object.defineProperty(exports, "ISO8601DateTime", { enumerable: true, get: function () { return ISO8601DateTime_js_1.ISO8601DateTime; } });
|
|
12
|
+
const ISO8601DateValidator_js_1 = require("./domain/entities/ISO8601DateValidator.js");
|
|
13
|
+
Object.defineProperty(exports, "ISO8601DateValidator", { enumerable: true, get: function () { return ISO8601DateValidator_js_1.ISO8601DateValidator; } });
|
|
14
|
+
const ISO8601Time_js_1 = require("./domain/entities/ISO8601Time.js");
|
|
15
|
+
Object.defineProperty(exports, "ISO8601Time", { enumerable: true, get: function () { return ISO8601Time_js_1.ISO8601Time; } });
|
|
16
|
+
const ISO8601TimeValidator_js_1 = require("./domain/entities/ISO8601TimeValidator.js");
|
|
17
|
+
Object.defineProperty(exports, "ISO8601TimeValidator", { enumerable: true, get: function () { return ISO8601TimeValidator_js_1.ISO8601TimeValidator; } });
|
|
18
|
+
const UserUnavailableTime_js_1 = require("./domain/entities/UserUnavailableTime.js");
|
|
19
|
+
Object.defineProperty(exports, "UserUnavailableTime", { enumerable: true, get: function () { return UserUnavailableTime_js_1.UserUnavailableTime; } });
|
|
20
|
+
const FreeTimeSlot_js_1 = require("./domain/entities/FreeTimeSlot.js");
|
|
21
|
+
Object.defineProperty(exports, "FreeDateTimeSlot", { enumerable: true, get: function () { return FreeTimeSlot_js_1.FreeDateTimeSlot; } });
|
package/package.json
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eliasrrosa/tutorhub-public-assets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Assets, mainly interfaces, to be shared among different Tutorhub apps.",
|
|
5
|
-
"main": "/dist/index.js",
|
|
6
5
|
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.cjs",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
7
15
|
"files": [
|
|
8
|
-
"
|
|
16
|
+
"dist"
|
|
9
17
|
],
|
|
10
18
|
"scripts": {
|
|
11
|
-
"test": "npx jest --watch --passWithNoTests "
|
|
19
|
+
"test": "npx jest --watch --passWithNoTests ",
|
|
20
|
+
"build": "tsup src/index.ts --format esm,cjs && tsc"
|
|
12
21
|
},
|
|
13
22
|
"repository": {
|
|
14
23
|
"type": "git",
|
|
@@ -28,6 +37,7 @@
|
|
|
28
37
|
"@types/jest": "^29.5.14",
|
|
29
38
|
"jest": "^29.7.0",
|
|
30
39
|
"ts-jest": "^29.3.2",
|
|
40
|
+
"tsup": "^8.4.0",
|
|
31
41
|
"typescript": "^5.8.3"
|
|
32
42
|
}
|
|
33
43
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
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;
|
package/dist/entities/Class.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/entities/Class.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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;
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
}
|