@eliasrrosa/tutorhub-public-assets 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,4 @@
1
- import { IDate } from "./Date";
2
- import { ITimeSlot } from "./TimeSlot";
3
1
  export interface IDateTimeSlot {
4
- timeSlot: ITimeSlot;
5
- date: IDate;
2
+ startDateTime: Date;
3
+ endDateTime: Date;
6
4
  }
@@ -2,17 +2,14 @@ import { IUserAuth } from "./UserAuth";
2
2
  import { ICourse } from "./Course";
3
3
  import { IRescheduleRequest } from "./RescheduleRequest";
4
4
  import { IDateTimeSlot } from "./DateTimeSlot";
5
- import { IDate } from "./Date";
6
- import { ITime } from "./Time";
7
5
  export interface IUserUnavailableTime {
8
6
  id: string;
9
7
  userId: string;
10
8
  user?: IUserAuth;
11
9
  groupId: string;
12
- date: IDate;
13
10
  dayOfTheWeek: number;
14
- startTime: ITime;
15
- endTime: ITime;
11
+ startDateTime: Date;
12
+ endDateTime: Date;
16
13
  isAvailableTime: boolean;
17
14
  course?: ICourse;
18
15
  courseId: string | null;
@@ -24,9 +21,8 @@ export declare class UserUnavailableTime implements IUserUnavailableTime {
24
21
  userId: string;
25
22
  user?: IUserAuth;
26
23
  groupId: string;
27
- date: IDate;
28
- startTime: ITime;
29
- endTime: ITime;
24
+ startDateTime: Date;
25
+ endDateTime: Date;
30
26
  isAvailableTime: boolean;
31
27
  dayOfTheWeek: number;
32
28
  course?: ICourse;
@@ -37,9 +33,8 @@ export declare class UserUnavailableTime implements IUserUnavailableTime {
37
33
  userId: string;
38
34
  user?: IUserAuth;
39
35
  groupId: string;
40
- date: IDate;
41
- startTime: ITime | string;
42
- endTime: ITime | string;
36
+ startDateTime: Date;
37
+ endDateTime: Date;
43
38
  isAvailableTime: boolean;
44
39
  course?: ICourse;
45
40
  courseId: string | null;
@@ -1,33 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UserUnavailableTime = void 0;
4
- const ISO8601Time_1 = require("./ISO8601Time");
5
4
  class UserUnavailableTime {
6
5
  constructor(opts) {
7
6
  this.getDateTimeSlot = () => {
8
7
  return {
9
- date: this.date,
10
- timeSlot: {
11
- endTime: this.endTime,
12
- startTime: this.startTime,
13
- },
8
+ endDateTime: this.endDateTime,
9
+ startDateTime: this.startDateTime,
14
10
  };
15
11
  };
16
12
  this.id = opts.id;
17
13
  this.userId = opts.userId;
18
14
  this.user = opts.user;
19
15
  this.groupId = opts.groupId;
20
- this.date = opts.date;
16
+ this.startDateTime = opts.startDateTime;
17
+ this.endDateTime = opts.endDateTime;
21
18
  this.dayOfTheWeek = this.getDayOfTheWeek();
22
- this.startTime = typeof opts.startTime == "string" ? new ISO8601Time_1.ISO8601Time(opts.startTime) : opts.startTime;
23
- this.endTime = typeof opts.endTime == "string" ? new ISO8601Time_1.ISO8601Time(opts.endTime) : opts.endTime;
24
19
  this.isAvailableTime = opts.isAvailableTime;
25
20
  this.course = opts.course;
26
21
  this.courseId = opts.courseId;
27
22
  this.rescheduleRequests = opts.rescheduleRequests;
28
23
  }
29
24
  getDayOfTheWeek() {
30
- return this.date.getDayOfTheWeek();
25
+ return this.startDateTime.getUTCDay();
31
26
  }
32
27
  }
33
28
  exports.UserUnavailableTime = UserUnavailableTime;
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const ISO8601Date_1 = require("./ISO8601Date");
4
- const ISO8601Time_1 = require("./ISO8601Time");
5
3
  const UserUnavailableTime_1 = require("./UserUnavailableTime");
6
4
  describe("UserUnavailableTime", () => {
7
5
  const availableTimeData = {
8
6
  courseId: "courseId",
9
- date: new ISO8601Date_1.ISO8601Date("2025-01-01"),
10
- endTime: "15:00",
11
- startTime: "14:00",
7
+ startDateTime: new Date("2025-01-01T14:00:00Z"),
8
+ endDateTime: new Date("2025-01-01T15:00:00Z"),
12
9
  groupId: "groupId",
13
10
  id: "id",
14
11
  isAvailableTime: true,
@@ -23,22 +20,12 @@ describe("UserUnavailableTime", () => {
23
20
  const availableTime = new UserUnavailableTime_1.UserUnavailableTime(availableTimeData);
24
21
  expect(availableTime.dayOfTheWeek).toBe(3);
25
22
  });
26
- it("Should instantiate ISO8601Time for startTime and endTime", () => {
27
- const availableTime = new UserUnavailableTime_1.UserUnavailableTime(availableTimeData);
28
- expect(availableTime.startTime).toBeInstanceOf(ISO8601Time_1.ISO8601Time);
29
- expect(availableTime.endTime).toBeInstanceOf(ISO8601Time_1.ISO8601Time);
30
- });
31
- it("Should throw given invalid startTime or endTime format", () => {
32
- const availableTime = () => new UserUnavailableTime_1.UserUnavailableTime(Object.assign(Object.assign({}, availableTimeData), { startTime: "25:00:00" }));
33
- expect(availableTime).toThrow();
34
- });
35
23
  });
36
24
  describe("UserUnavailableTime.getDateTimeSlot()", () => {
37
25
  const availableTime = new UserUnavailableTime_1.UserUnavailableTime(Object.assign({}, availableTimeData));
38
26
  it("Should return an object of type IDateTimeSlot", () => {
39
- expect(availableTime.getDateTimeSlot().date).toBeInstanceOf(ISO8601Date_1.ISO8601Date);
40
- expect(availableTime.getDateTimeSlot().timeSlot.endTime).toBeInstanceOf(ISO8601Time_1.ISO8601Time);
41
- expect(availableTime.getDateTimeSlot().timeSlot.startTime).toBeInstanceOf(ISO8601Time_1.ISO8601Time);
27
+ expect(availableTime.getDateTimeSlot().startDateTime).toBeInstanceOf(Date);
28
+ expect(availableTime.getDateTimeSlot().endDateTime).toBeInstanceOf(Date);
42
29
  });
43
30
  });
44
31
  });
package/dist/index.cjs CHANGED
@@ -566,28 +566,24 @@ var UserUnavailableTime = class {
566
566
  constructor(opts) {
567
567
  this.getDateTimeSlot = () => {
568
568
  return {
569
- date: this.date,
570
- timeSlot: {
571
- endTime: this.endTime,
572
- startTime: this.startTime
573
- }
569
+ endDateTime: this.endDateTime,
570
+ startDateTime: this.startDateTime
574
571
  };
575
572
  };
576
573
  this.id = opts.id;
577
574
  this.userId = opts.userId;
578
575
  this.user = opts.user;
579
576
  this.groupId = opts.groupId;
580
- this.date = opts.date;
577
+ this.startDateTime = opts.startDateTime;
578
+ this.endDateTime = opts.endDateTime;
581
579
  this.dayOfTheWeek = this.getDayOfTheWeek();
582
- this.startTime = typeof opts.startTime == "string" ? new ISO8601Time(opts.startTime) : opts.startTime;
583
- this.endTime = typeof opts.endTime == "string" ? new ISO8601Time(opts.endTime) : opts.endTime;
584
580
  this.isAvailableTime = opts.isAvailableTime;
585
581
  this.course = opts.course;
586
582
  this.courseId = opts.courseId;
587
583
  this.rescheduleRequests = opts.rescheduleRequests;
588
584
  }
589
585
  getDayOfTheWeek() {
590
- return this.date.getDayOfTheWeek();
586
+ return this.startDateTime.getUTCDay();
591
587
  }
592
588
  };
593
589
 
package/dist/index.js CHANGED
@@ -528,28 +528,24 @@ var UserUnavailableTime = class {
528
528
  constructor(opts) {
529
529
  this.getDateTimeSlot = () => {
530
530
  return {
531
- date: this.date,
532
- timeSlot: {
533
- endTime: this.endTime,
534
- startTime: this.startTime
535
- }
531
+ endDateTime: this.endDateTime,
532
+ startDateTime: this.startDateTime
536
533
  };
537
534
  };
538
535
  this.id = opts.id;
539
536
  this.userId = opts.userId;
540
537
  this.user = opts.user;
541
538
  this.groupId = opts.groupId;
542
- this.date = opts.date;
539
+ this.startDateTime = opts.startDateTime;
540
+ this.endDateTime = opts.endDateTime;
543
541
  this.dayOfTheWeek = this.getDayOfTheWeek();
544
- this.startTime = typeof opts.startTime == "string" ? new ISO8601Time(opts.startTime) : opts.startTime;
545
- this.endTime = typeof opts.endTime == "string" ? new ISO8601Time(opts.endTime) : opts.endTime;
546
542
  this.isAvailableTime = opts.isAvailableTime;
547
543
  this.course = opts.course;
548
544
  this.courseId = opts.courseId;
549
545
  this.rescheduleRequests = opts.rescheduleRequests;
550
546
  }
551
547
  getDayOfTheWeek() {
552
- return this.date.getDayOfTheWeek();
548
+ return this.startDateTime.getUTCDay();
553
549
  }
554
550
  };
555
551
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliasrrosa/tutorhub-public-assets",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Assets, mainly interfaces, to be shared among different Tutorhub apps.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",