@eliasrrosa/tutorhub-public-assets 0.7.0 → 0.7.1

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.
@@ -7,7 +7,7 @@ import { IPayment } from "./Payment";
7
7
  import { IPreApprovedUser } from "./PreApprovedUser";
8
8
  import { ISchool } from "./School";
9
9
  import { IUserAuth } from "./UserAuth";
10
- import { IUserUnavailableTime } from "./UserUnavailableTime";
10
+ import { IUserTimeSlot } from "./UserTimeSlot";
11
11
  export interface ICourse {
12
12
  id: string;
13
13
  title: string;
@@ -24,7 +24,7 @@ export interface ICourse {
24
24
  classes?: IClass[];
25
25
  payments?: IPayment[];
26
26
  files?: IFile[];
27
- availableTimes?: IUserUnavailableTime[];
27
+ availableTimes?: IUserTimeSlot[];
28
28
  classRequests?: IClassRequest[];
29
29
  meetingLink: string | null;
30
30
  contracts?: IContract[];
@@ -1,6 +1,6 @@
1
1
  import { IClass } from "./Class";
2
2
  import { IUserAuth } from "./UserAuth";
3
- import { IUserUnavailableTime } from "./UserUnavailableTime";
3
+ import { IUserTimeSlot } from "./UserTimeSlot";
4
4
  export interface IRescheduleRequest {
5
5
  id: string;
6
6
  isRecurrent: boolean;
@@ -10,7 +10,7 @@ export interface IRescheduleRequest {
10
10
  createdAt: Date | null;
11
11
  requester?: IUserAuth;
12
12
  targetClass?: IClass;
13
- targetAvailableTime?: IUserUnavailableTime;
13
+ targetAvailableTime?: IUserTimeSlot;
14
14
  usersThatAccepted?: IUserAuth[];
15
15
  usersThatDenied?: IUserAuth[];
16
16
  }
@@ -21,7 +21,7 @@ import { IUserPremium } from "./UserPremium";
21
21
  import { IUserProfile } from "./UserProfile";
22
22
  import { IUserRoles } from "./UserRoles";
23
23
  import { IUserSharedFileTimestamps } from "./UserSharedFileTimestamps";
24
- import { IUserUnavailableTime } from "./UserUnavailableTime";
24
+ import { IUserTimeSlot } from "./UserTimeSlot";
25
25
  export interface IUserAuth {
26
26
  id: string;
27
27
  email: string;
@@ -42,7 +42,7 @@ export interface IUserAuth {
42
42
  receivedConnectionRequests?: IUserConnectionRequest[];
43
43
  connections1?: IUserConnection[];
44
44
  connections2?: IUserConnection[];
45
- unavailableTime?: IUserUnavailableTime[];
45
+ unavailableTime?: IUserTimeSlot[];
46
46
  classRequestsSent?: IClassRequest[];
47
47
  classRequestsReceived?: IClassRequest[];
48
48
  notificationsSent?: IGenericNotification[];
@@ -0,0 +1,45 @@
1
+ import { IUserAuth } from "./UserAuth";
2
+ import { ICourse } from "./Course";
3
+ import { IRescheduleRequest } from "./RescheduleRequest";
4
+ import { IDateTimeSlot } from "./DateTimeSlot";
5
+ export interface IUserTimeSlot {
6
+ id: string;
7
+ userId: string;
8
+ user?: IUserAuth;
9
+ groupId: string;
10
+ dayOfTheWeek: number;
11
+ startDateTime: Date;
12
+ endDateTime: Date;
13
+ isAvailableTime: boolean;
14
+ course?: ICourse;
15
+ courseId: string | null;
16
+ rescheduleRequests?: IRescheduleRequest[];
17
+ getDateTimeSlot: () => IDateTimeSlot;
18
+ }
19
+ export declare class UserTimeSlot implements IUserTimeSlot {
20
+ id: string;
21
+ userId: string;
22
+ user?: IUserAuth;
23
+ groupId: string;
24
+ startDateTime: Date;
25
+ endDateTime: Date;
26
+ isAvailableTime: boolean;
27
+ dayOfTheWeek: number;
28
+ course?: ICourse;
29
+ courseId: string | null;
30
+ rescheduleRequests?: IRescheduleRequest[];
31
+ constructor(opts: {
32
+ id: string;
33
+ userId: string;
34
+ user?: IUserAuth;
35
+ groupId: string;
36
+ startDateTime: Date;
37
+ endDateTime: Date;
38
+ isAvailableTime: boolean;
39
+ course?: ICourse;
40
+ courseId: string | null;
41
+ rescheduleRequests?: IRescheduleRequest[];
42
+ });
43
+ private getDayOfTheWeek;
44
+ getDateTimeSlot: () => IDateTimeSlot;
45
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserTimeSlot = void 0;
4
+ class UserTimeSlot {
5
+ constructor(opts) {
6
+ this.getDateTimeSlot = () => {
7
+ return {
8
+ endDateTime: this.endDateTime,
9
+ startDateTime: this.startDateTime,
10
+ };
11
+ };
12
+ this.id = opts.id;
13
+ this.userId = opts.userId;
14
+ this.user = opts.user;
15
+ this.groupId = opts.groupId;
16
+ this.startDateTime = opts.startDateTime;
17
+ this.endDateTime = opts.endDateTime;
18
+ this.dayOfTheWeek = this.getDayOfTheWeek();
19
+ this.isAvailableTime = opts.isAvailableTime;
20
+ this.course = opts.course;
21
+ this.courseId = opts.courseId;
22
+ this.rescheduleRequests = opts.rescheduleRequests;
23
+ }
24
+ getDayOfTheWeek() {
25
+ return this.startDateTime.getUTCDay();
26
+ }
27
+ }
28
+ exports.UserTimeSlot = UserTimeSlot;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const UserTimeSlot_1 = require("./UserTimeSlot");
4
+ describe("UserUnavailableTime", () => {
5
+ const availableTimeData = {
6
+ courseId: "courseId",
7
+ startDateTime: new Date("2025-01-01T14:00:00Z"),
8
+ endDateTime: new Date("2025-01-01T15:00:00Z"),
9
+ groupId: "groupId",
10
+ id: "id",
11
+ isAvailableTime: true,
12
+ userId: "userId",
13
+ };
14
+ describe("UserUnavailableTime constructor()", () => {
15
+ it("Should be instantiable.", () => {
16
+ const availableTime = new UserTimeSlot_1.UserTimeSlot(availableTimeData);
17
+ expect(availableTime).toBeDefined();
18
+ });
19
+ it("Should contain the proper dayOfTheWeek.", () => {
20
+ const availableTime = new UserTimeSlot_1.UserTimeSlot(availableTimeData);
21
+ expect(availableTime.dayOfTheWeek).toBe(3);
22
+ });
23
+ });
24
+ describe("UserUnavailableTime.getDateTimeSlot()", () => {
25
+ const availableTime = new UserTimeSlot_1.UserTimeSlot(Object.assign({}, availableTimeData));
26
+ it("Should return an object of type IDateTimeSlot", () => {
27
+ expect(availableTime.getDateTimeSlot().startDateTime).toBeInstanceOf(Date);
28
+ expect(availableTime.getDateTimeSlot().endDateTime).toBeInstanceOf(Date);
29
+ });
30
+ });
31
+ });
@@ -1,4 +1,4 @@
1
- import { IUserUnavailableTime } from "../entities/UserUnavailableTime";
1
+ import { IUserTimeSlot } from "../entities/UserTimeSlot";
2
2
  export interface IUnavailableTimeRepository {
3
3
  findAvailableTimesByTime: (opts: {
4
4
  startTime: string;
@@ -7,7 +7,7 @@ export interface IUnavailableTimeRepository {
7
7
  dateGreaterThanOrEqualTo?: Date | string;
8
8
  dateGreaterThan?: Date | string;
9
9
  dateLessThanOrEqualTo?: Date | string;
10
- }) => Promise<IUserUnavailableTime[]>;
10
+ }) => Promise<IUserTimeSlot[]>;
11
11
  /**Does not throw. Returns empty array if query fails. */
12
12
  findAvailableTimesByDate: (opts: {
13
13
  dateGreaterThanOrEqualTo?: string | Date;
@@ -16,5 +16,5 @@ export interface IUnavailableTimeRepository {
16
16
  startTime?: string;
17
17
  endTime?: string;
18
18
  userId?: string;
19
- }) => Promise<IUserUnavailableTime[]>;
19
+ }) => Promise<IUserTimeSlot[]>;
20
20
  }
package/dist/index.cjs CHANGED
@@ -50,7 +50,7 @@ __export(index_exports, {
50
50
  ISO8601DateValidator: () => ISO8601DateValidator,
51
51
  ISO8601Time: () => ISO8601Time,
52
52
  ISO8601TimeValidator: () => ISO8601TimeValidator,
53
- UserUnavailableTime: () => UserUnavailableTime,
53
+ UserUnavailableTime: () => UserTimeSlot,
54
54
  filterAsync: () => filterAsync,
55
55
  tryCatch: () => tryCatch,
56
56
  tryCatchAsync: () => tryCatchAsync
@@ -561,8 +561,8 @@ var ClassCreationFormSchema = import_zod2.z.object({
561
561
  var import_zod3 = require("zod");
562
562
  var ClassCreationRecurrenceRuleSchema = import_zod3.z.literal("daily").or(import_zod3.z.literal("weekly")).or(import_zod3.z.literal("week days"));
563
563
 
564
- // src/domain/entities/UserUnavailableTime.ts
565
- var UserUnavailableTime = class {
564
+ // src/domain/entities/UserTimeSlot.ts
565
+ var UserTimeSlot = class {
566
566
  constructor(opts) {
567
567
  this.getDateTimeSlot = () => {
568
568
  return {
package/dist/index.d.ts CHANGED
@@ -47,8 +47,8 @@ import { ClassCreationForm, ClassCreationFormSchema } from "./infrastructure/res
47
47
  import { ClassStatus, ClassStatusSchema } from "./domain/types/ClassStatus.js";
48
48
  import { ClassCreationRecurrenceRule, ClassCreationRecurrenceRuleSchema } from "./domain/types/ClassCreationRecurrenceRule.js";
49
49
  import { IClassStatus } from "./domain/entities/ClassStatus.js";
50
- import { IUserUnavailableTime, UserUnavailableTime } from "./domain/entities/UserUnavailableTime.js";
50
+ import { IUserTimeSlot, UserTimeSlot } from "./domain/entities/UserTimeSlot.js";
51
51
  import { IFreeDateTimeSlot, FreeDateTimeSlot } from "./domain/entities/FreeTimeSlot.js";
52
52
  import { tryCatch, tryCatchAsync } from "./application/helpers/helpers/tryCatch.js";
53
53
  import { filterAsync } from "./application/helpers/helpers/filterAsync.js";
54
- export { filterAsync, tryCatchAsync, tryCatch, ClassStatus, AsaasCustomer, 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, ClassCreationForm, ClassCreationRecurrenceRule, ClassCreationFormSchema, ClassCreationRecurrenceRuleSchema, ClassStatusSchema, IClassStatus };
54
+ export { filterAsync, tryCatchAsync, tryCatch, ClassStatus, AsaasCustomer, IClass, IClassRequest, IContract, ICourse, ICourseToSchoolConnectionRequest, IDate, IDateTimeSlot, IFreeDateTimeSlot, FreeDateTimeSlot, IUserTimeSlot as IUserUnavailableTime, UserTimeSlot as 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, ClassCreationForm, ClassCreationRecurrenceRule, ClassCreationFormSchema, ClassCreationRecurrenceRuleSchema, ClassStatusSchema, IClassStatus };
package/dist/index.js CHANGED
@@ -523,8 +523,8 @@ var ClassCreationFormSchema = z2.object({
523
523
  import { z as z3 } from "zod";
524
524
  var ClassCreationRecurrenceRuleSchema = z3.literal("daily").or(z3.literal("weekly")).or(z3.literal("week days"));
525
525
 
526
- // src/domain/entities/UserUnavailableTime.ts
527
- var UserUnavailableTime = class {
526
+ // src/domain/entities/UserTimeSlot.ts
527
+ var UserTimeSlot = class {
528
528
  constructor(opts) {
529
529
  this.getDateTimeSlot = () => {
530
530
  return {
@@ -594,7 +594,7 @@ export {
594
594
  ISO8601DateValidator,
595
595
  ISO8601Time,
596
596
  ISO8601TimeValidator,
597
- UserUnavailableTime,
597
+ UserTimeSlot as UserUnavailableTime,
598
598
  filterAsync,
599
599
  tryCatch,
600
600
  tryCatchAsync
@@ -1,5 +1,5 @@
1
- import { IUserUnavailableTime } from "../../../domain/entities/UserUnavailableTime";
1
+ import { IUserTimeSlot } from "../../../domain/entities/UserTimeSlot";
2
2
  export type GetFixedAvailableTimeResponseBody = {
3
- fixedAvailableTimes: IUserUnavailableTime[];
3
+ fixedAvailableTimes: IUserTimeSlot[];
4
4
  shareableText?: string;
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliasrrosa/tutorhub-public-assets",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Assets, mainly interfaces, to be shared among different Tutorhub apps.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",