ldco-contract 0.1.14 → 0.1.16

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 (89) hide show
  1. package/dist/index.d.ts +34 -0
  2. package/dist/ldco-contract.cjs.development.js +327 -0
  3. package/dist/ldco-contract.cjs.development.js.map +1 -1
  4. package/dist/ldco-contract.cjs.production.min.js +1 -1
  5. package/dist/ldco-contract.cjs.production.min.js.map +1 -1
  6. package/dist/ldco-contract.esm.js +311 -1
  7. package/dist/ldco-contract.esm.js.map +1 -1
  8. package/dist/lib/converters/toChoreographerDTO.d.ts +3 -0
  9. package/dist/lib/converters/toChoreographerModel.d.ts +3 -0
  10. package/dist/lib/converters/toCollectionsModel.d.ts +6 -0
  11. package/dist/lib/converters/toDanceDTO.d.ts +3 -0
  12. package/dist/lib/converters/toDanceModel.d.ts +5 -0
  13. package/dist/lib/converters/toInstructorDTO.d.ts +3 -0
  14. package/dist/lib/converters/toInstructorModel.d.ts +3 -0
  15. package/dist/lib/converters/toLessonDTO.d.ts +3 -0
  16. package/dist/lib/converters/toLessonModel.d.ts +4 -0
  17. package/dist/lib/converters/toTrackDTO.d.ts +3 -0
  18. package/dist/lib/converters/toTrackModel.d.ts +3 -0
  19. package/dist/lib/converters/toUserAcquaintanceDTO.d.ts +14 -0
  20. package/dist/lib/converters/toUserAcquaintanceModel.d.ts +7 -0
  21. package/dist/lib/converters/toUserDTO.d.ts +9 -0
  22. package/dist/lib/converters/toUserModel.d.ts +7 -0
  23. package/dist/lib/converters/toVenueDTO.d.ts +3 -0
  24. package/dist/lib/converters/toVenueModel.d.ts +5 -0
  25. package/dist/types/dto/lesson.dto.d.ts +1 -0
  26. package/dist/types/entities/appeal_choreographer_user.entity.d.ts +8 -0
  27. package/dist/types/entities/appeal_instructor_user.entity.d.ts +8 -0
  28. package/dist/types/entities/cancelled_lesson.entity.d.ts +6 -0
  29. package/dist/types/entities/choreographer.entity.d.ts +5 -0
  30. package/dist/types/entities/dance.entity.d.ts +9 -0
  31. package/dist/types/entities/dance_collection.entity.d.ts +8 -0
  32. package/dist/types/entities/friend_request.entity.d.ts +7 -0
  33. package/dist/types/entities/instructor.entity.d.ts +5 -0
  34. package/dist/types/entities/lesson.entity.d.ts +13 -0
  35. package/dist/types/entities/track.entity.d.ts +9 -0
  36. package/dist/types/entities/user.entity.d.ts +9 -0
  37. package/dist/types/entities/user_collection.entity.d.ts +8 -0
  38. package/dist/types/entities/user_favorite_venue.entity.d.ts +5 -0
  39. package/dist/types/entities/user_follow.entity.d.ts +6 -0
  40. package/dist/types/entities/user_friend.entity.d.ts +6 -0
  41. package/dist/types/entities/user_marked_dance.entity.d.ts +6 -0
  42. package/dist/types/entities/venue.entity.d.ts +14 -0
  43. package/dist/types/model/collection.model.d.ts +1 -0
  44. package/dist/types/model/dance.model.d.ts +1 -0
  45. package/dist/types/model/lesson.model.d.ts +1 -0
  46. package/dist/types/requests/userInfoUpdate.request.d.ts +0 -1
  47. package/package.json +1 -1
  48. package/src/index.ts +39 -1
  49. package/src/lib/converters/toChoreographerDTO.ts +14 -0
  50. package/src/lib/converters/toChoreographerModel.ts +13 -0
  51. package/src/lib/converters/toCollectionsModel.ts +26 -0
  52. package/src/lib/converters/toDanceDTO.ts +19 -0
  53. package/src/lib/converters/toDanceModel.ts +28 -0
  54. package/src/lib/converters/toInstructorDTO.ts +15 -0
  55. package/src/lib/converters/toInstructorModel.ts +14 -0
  56. package/src/lib/converters/toLessonDTO.ts +20 -0
  57. package/src/lib/converters/toLessonModel.ts +20 -0
  58. package/src/lib/converters/toTrackDTO.ts +15 -0
  59. package/src/lib/converters/toTrackModel.ts +15 -0
  60. package/src/lib/converters/toUserAcquaintanceDTO.ts +42 -0
  61. package/src/lib/converters/toUserAcquaintanceModel.ts +36 -0
  62. package/src/lib/converters/toUserDTO.ts +41 -0
  63. package/src/lib/converters/toUserModel.ts +43 -0
  64. package/src/lib/converters/toVenueDTO.ts +26 -0
  65. package/src/lib/converters/toVenueModel.ts +20 -0
  66. package/src/types/dto/lesson.dto.ts +1 -0
  67. package/src/types/entities/appeal_choreographer_user.entity.ts +8 -0
  68. package/src/types/entities/appeal_instructor_user.entity.ts +8 -0
  69. package/src/types/entities/cancelled_lesson.entity.ts +6 -0
  70. package/src/types/entities/choreographer.entity.ts +5 -0
  71. package/src/types/entities/dance.entity.ts +9 -0
  72. package/src/types/entities/dance_collection.entity.ts +8 -0
  73. package/src/types/entities/friend_request.entity.ts +7 -0
  74. package/src/types/entities/instructor.entity.ts +5 -0
  75. package/src/types/entities/lesson.entity.ts +13 -0
  76. package/src/types/entities/track.entity.ts +9 -0
  77. package/src/types/entities/user.entity.ts +9 -0
  78. package/src/types/entities/user_collection.entity.ts +8 -0
  79. package/src/types/entities/user_favorite_venue.entity.ts +5 -0
  80. package/src/types/entities/user_follow.entity.ts +6 -0
  81. package/src/types/entities/user_friend.entity.ts +6 -0
  82. package/src/types/entities/user_marked_dance.entity.ts +6 -0
  83. package/src/types/entities/venue.entity.ts +14 -0
  84. package/src/types/model/collection.model.ts +1 -0
  85. package/src/types/model/dance.model.ts +1 -0
  86. package/src/types/model/lesson.model.ts +1 -0
  87. package/src/types/requests/userInfoUpdate.request.ts +0 -1
  88. package/dist/converter/userEntityToUser.d.ts +0 -10
  89. package/src/converter/userEntityToUser.ts +0 -76
@@ -0,0 +1,6 @@
1
+ export interface UserFriendEntity {
2
+ _id: string;
3
+ userId: string;
4
+ friendId: string;
5
+ createdAt: Date;
6
+ }
@@ -0,0 +1,6 @@
1
+ export interface UserMarkedDanceEntity {
2
+ _id: string;
3
+ userId: string;
4
+ danceId: string;
5
+ createdAt: Date;
6
+ }
@@ -0,0 +1,14 @@
1
+ export interface VenueEntity {
2
+ _id: string;
3
+ venuename: string;
4
+ venueaddress: string;
5
+ geolocation: [number, number];
6
+ phone: string;
7
+ website: string;
8
+ contactEmail: string;
9
+ contactName: string;
10
+ contactPhone: string;
11
+ isDeleted?: boolean;
12
+ deletedAt?: Date;
13
+ createdAt?: Date;
14
+ }
@@ -1,5 +1,6 @@
1
1
  import { DanceModel } from "./dance.model";
2
2
  export interface CollectionModel {
3
+ id: string;
3
4
  name: string;
4
5
  dances: DanceModel[];
5
6
  createdAt: Date;
@@ -1,6 +1,7 @@
1
1
  import { ChoreographerModel } from './choreographer.model';
2
2
  import { TrackModel } from './track.model';
3
3
  export interface DanceModel {
4
+ id: string;
4
5
  danceName: string;
5
6
  choreographers: ChoreographerModel[];
6
7
  stepsheet: string;
@@ -1,5 +1,6 @@
1
1
  import { InstructorModel } from "./instructor.model";
2
2
  export interface LessonModel {
3
+ id: string;
3
4
  lessonday: string;
4
5
  lessonstart: string;
5
6
  instructors: InstructorModel[];
@@ -1,6 +1,5 @@
1
1
  import { SocialMediaLinks } from "../model/userTypes/socialMediaLinks";
2
2
  export interface UserInfoUpdateRequest {
3
- userId: string;
4
3
  name?: string;
5
4
  username?: string;
6
5
  profilePictureUrl?: string;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.14",
2
+ "version": "0.1.16",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,3 +1,22 @@
1
+ // ENTITIES
2
+ export { AppealChoreographerUser } from './types/entities/appeal_choreographer_user.entity';
3
+ export { AppealInstructorUser } from './types/entities/appeal_instructor_user.entity';
4
+ export { CancelledLessonEntity } from './types/entities/cancelled_lesson.entity';
5
+ export { ChoreographerEntity } from './types/entities/choreographer.entity';
6
+ export { DanceCollectionEntity } from './types/entities/dance_collection.entity';
7
+ export { DanceEntity } from './types/entities/dance.entity';
8
+ export { FriendRequestEntity } from './types/entities/friend_request.entity';
9
+ export { InstructorEntity } from './types/entities/instructor.entity';
10
+ export { LessonEntity } from './types/entities/lesson.entity';
11
+ export { TrackEntity } from './types/entities/track.entity';
12
+ export { UserCollectionEntity } from './types/entities/user_collection.entity'; //TODO: What's the difference between a DanceCollection and a UserCollection?
13
+ export { UserFavoriteVenueEntity } from './types/entities/user_favorite_venue.entity';
14
+ export { UserFollowEntity } from './types/entities/user_follow.entity';
15
+ export { UserFriendEntity } from './types/entities/user_friend.entity';
16
+ export { UserMarkedDanceEntity } from './types/entities/user_marked_dance.entity';
17
+ export { UserEntity } from './types/entities/user.entity';
18
+ export { VenueEntity } from './types/entities/venue.entity';
19
+
1
20
  // DTOS
2
21
  export { ChoreographerDTO } from './types/dto/choreographer.dto';
3
22
  export { CollectionDTO } from './types/dto/collection.dto';
@@ -31,4 +50,23 @@ export { UserDances } from './types/model/userTypes/userDances';
31
50
  export { getAllUserDanceIds } from './lib/getAllUserDanceIds';
32
51
 
33
52
  // REQUESTS
34
- export { UserInfoUpdateRequest } from './types/requests/userInfoUpdate.request';
53
+ export { UserInfoUpdateRequest } from './types/requests/userInfoUpdate.request';
54
+
55
+ // CONVERTERS
56
+ export { toChoreographerDTO } from './lib/converters/toChoreographerDTO';
57
+ export { toChoreographerModel } from './lib/converters/toChoreographerModel';
58
+ export { toCollectionModel } from './lib/converters/toCollectionsModel';
59
+ export { toDanceDTO } from './lib/converters/toDanceDTO';
60
+ export { toDanceModel } from './lib/converters/toDanceModel';
61
+ export { toInstructorDTO } from './lib/converters/toInstructorDTO';
62
+ export { toInstructorModel } from './lib/converters/toInstructorModel';
63
+ export { toLessonDTO } from './lib/converters/toLessonDTO';
64
+ export { toLessonModel } from './lib/converters/toLessonModel';
65
+ export { toTrackDTO } from './lib/converters/toTrackDTO';
66
+ export { toTrackModel } from './lib/converters/toTrackModel';
67
+ export { toUserAcquaintanceDTO } from './lib/converters/toUserAcquaintanceDTO';
68
+ export { toUserAcquaintanceModel } from './lib/converters/toUserAcquaintanceModel';
69
+ export { toUserDTO } from './lib/converters/toUserDTO';
70
+ export { toUserModel } from './lib/converters/toUserModel';
71
+ export { toVenueDTO } from './lib/converters/toVenueDTO';
72
+ export { toVenueModel } from './lib/converters/toVenueModel';
@@ -0,0 +1,14 @@
1
+ import { ChoreographerDTO } from '../../types/dto/choreographer.dto';
2
+ import { ChoreographerEntity } from '../../types/entities/choreographer.entity';
3
+
4
+ export function toChoreographerDTO(
5
+ choreographer: ChoreographerEntity,
6
+ isVerified: boolean
7
+ ): ChoreographerDTO {
8
+
9
+ return {
10
+ id: choreographer._id,
11
+ name: choreographer.name,
12
+ isVerified: isVerified
13
+ };
14
+ }
@@ -0,0 +1,13 @@
1
+ import { ChoreographerDTO } from "../../types/dto/choreographer.dto";
2
+ import { ChoreographerModel } from "../../types/model/choreographer.model";
3
+
4
+ export function toChoreographerModel(
5
+ dto: ChoreographerDTO
6
+ ): ChoreographerModel {
7
+
8
+ return {
9
+ id: dto.id,
10
+ name: dto.name,
11
+ isVerified: dto.isVerified
12
+ };
13
+ }
@@ -0,0 +1,26 @@
1
+ import { ChoreographerDTO } from '../../types/dto/choreographer.dto';
2
+ import { CollectionDTO } from '../../types/dto/collection.dto';
3
+ import { DanceDTO } from '../../types/dto/dance.dto';
4
+ import { TrackDTO } from '../../types/dto/track.dto';
5
+ import { CollectionModel } from '../../types/model/collection.model';
6
+ import { toDanceModel } from './toDanceModel';
7
+
8
+ export function toCollectionModel(
9
+ dto: CollectionDTO,
10
+ danceMap: Record<string, DanceDTO>,
11
+ trackMap: Record<string, TrackDTO>,
12
+ choreographerMap: Record<string, ChoreographerDTO>
13
+ ): CollectionModel {
14
+ const dances = dto.dances.map(id => danceMap[id]).filter(Boolean);
15
+
16
+ return {
17
+ id: dto._id,
18
+ name: dto.name,
19
+ dances: dances.map(d => toDanceModel(d, trackMap, choreographerMap)),
20
+ isVerified: dto.isVerified,
21
+ createdAt: dto.createdAt,
22
+ updatedAt: dto.updatedAt,
23
+ createdBy: dto.createdBy,
24
+ isCopyable: dto.isCopyable,
25
+ };
26
+ }
@@ -0,0 +1,19 @@
1
+ import { DanceDTO } from "../../types/dto/dance.dto";
2
+ import { DanceEntity } from "../../types/entities/dance.entity";
3
+
4
+ export function toDanceDTO(
5
+ dance: DanceEntity,
6
+ isVerified: boolean
7
+ ): DanceDTO {
8
+
9
+ return {
10
+ id: dance._id,
11
+ danceName: dance.danceName,
12
+ choreographers: dance.choreographers?.map((id: string) => id) ?? [],
13
+ stepsheet: dance.stepsheet,
14
+ difficulty: dance.difficulty,
15
+ primaryTrack: dance.primaryTrack ?? '',
16
+ tracks: dance.tracks?.map((id: string) => id) ?? [],
17
+ isVerified: isVerified
18
+ };
19
+ };
@@ -0,0 +1,28 @@
1
+ import { ChoreographerDTO } from '../../types/dto/choreographer.dto';
2
+ import { DanceDTO } from '../../types/dto/dance.dto';
3
+ import { TrackDTO } from '../../types/dto/track.dto';
4
+ import { DanceModel } from '../../types/model/dance.model';
5
+ import { toChoreographerModel } from './toChoreographerModel';
6
+ import { toTrackModel } from './toTrackModel';
7
+
8
+ export function toDanceModel(
9
+ dto: DanceDTO,
10
+ trackMap: Record<string, TrackDTO>,
11
+ choreographerMap: Record<string, ChoreographerDTO>
12
+ ): DanceModel {
13
+
14
+ const tracks = dto.tracks
15
+ .map(id => trackMap[id])
16
+ .filter(Boolean);
17
+
18
+ return {
19
+ id: dto.id,
20
+ danceName: dto.danceName,
21
+ choreographers: dto.choreographers.map(id => toChoreographerModel(choreographerMap[id])),
22
+ stepsheet: dto.stepsheet,
23
+ difficulty: dto.difficulty,
24
+ primaryTrack: toTrackModel(trackMap[dto.primaryTrack]),
25
+ tracks: tracks.map(toTrackModel),
26
+ isVerified: dto.isVerified,
27
+ };
28
+ }
@@ -0,0 +1,15 @@
1
+ import { InstructorDTO } from "../../types/dto/instructor.dto";
2
+ import { InstructorEntity } from "../../types/entities/instructor.entity";
3
+
4
+ export function toInstructorDTO(
5
+ instructor: InstructorEntity,
6
+ isVerified: boolean
7
+ ): InstructorDTO {
8
+
9
+ return {
10
+ id: instructor._id,
11
+ name: instructor.name,
12
+ userid: "leave this this empty for now and figure it out later...",
13
+ isVerified: isVerified
14
+ };
15
+ }
@@ -0,0 +1,14 @@
1
+ import { InstructorDTO } from "../../types/dto/instructor.dto";
2
+ import { InstructorModel } from "../../types/model/instructor.model";
3
+
4
+ export function toInstructorModel(
5
+ dto: InstructorDTO,
6
+ ): InstructorModel {
7
+
8
+ return {
9
+ id: dto.id,
10
+ name: dto.name,
11
+ userid: "leave this this empty for now and figure it out later...",
12
+ isVerified: dto.isVerified
13
+ };
14
+ }
@@ -0,0 +1,20 @@
1
+ import { LessonDTO } from "../../types/dto/lesson.dto";
2
+ import { LessonEntity } from "../../types/entities/lesson.entity";
3
+
4
+ export function toLessonDTO(
5
+ LessonEntity: LessonEntity,
6
+ isVerified: boolean
7
+ ): LessonDTO {
8
+
9
+ return {
10
+ id: LessonEntity._id,
11
+ lessonday: LessonEntity.lessonday,
12
+ lessonstart: LessonEntity.lessonstart,
13
+ instructors: LessonEntity.instructors,
14
+ duration: LessonEntity.duration,
15
+ lessoncost: LessonEntity.lessoncost,
16
+ notes: LessonEntity.notes,
17
+ difficulty: LessonEntity.difficulty,
18
+ isVerified: isVerified
19
+ };
20
+ }
@@ -0,0 +1,20 @@
1
+ import { InstructorDTO } from "../../types/dto/instructor.dto";
2
+ import { LessonDTO } from "../../types/dto/lesson.dto";
3
+ import { LessonModel } from "../../types/model/lesson.model";
4
+
5
+ export function toLessonModel(
6
+ lessonDTO: LessonDTO,
7
+ instructorMap: Record<string, InstructorDTO>
8
+ ): LessonModel {
9
+
10
+ return {
11
+ id: lessonDTO.id,
12
+ lessonday: lessonDTO.lessonday,
13
+ lessonstart: lessonDTO.lessonstart,
14
+ instructors: lessonDTO.instructors.map(id => instructorMap[id]).filter(Boolean), // TODO: Do I need the converter?
15
+ duration: lessonDTO.duration,
16
+ lessoncost: lessonDTO.lessoncost,
17
+ notes: lessonDTO.notes,
18
+ difficulty: lessonDTO.difficulty,
19
+ };
20
+ }
@@ -0,0 +1,15 @@
1
+ import { TrackDTO } from "../../types/dto/track.dto";
2
+ import { TrackEntity } from "../../types/entities/track.entity";
3
+
4
+ export function toTrackDTO(dto: TrackEntity, isVerified: boolean): TrackDTO {
5
+ return {
6
+ id: dto._id,
7
+ name: dto.name,
8
+ artists: dto.artists,
9
+ isrc: dto.isrc,
10
+ uri: dto.uri,
11
+ duration_ms: dto.duration_ms,
12
+ explicit: dto.explicit,
13
+ isVerified: isVerified,
14
+ };
15
+ }
@@ -0,0 +1,15 @@
1
+ import { TrackDTO } from "../../types/dto/track.dto";
2
+ import { TrackModel } from "../../types/model/track.model";
3
+
4
+ export function toTrackModel(dto: TrackDTO): TrackModel {
5
+ return {
6
+ id: dto.id,
7
+ name: dto.name,
8
+ artists: dto.artists,
9
+ isrc: dto.isrc,
10
+ uri: dto.uri,
11
+ duration_ms: dto.duration_ms,
12
+ explicit: dto.explicit,
13
+ isVerified: dto.isVerified,
14
+ };
15
+ }
@@ -0,0 +1,42 @@
1
+ import { UserAcquaintanceDTO } from "../../types/dto/userAcquaintance.dto";
2
+ import { UserEntity } from "../../types/entities/user.entity";
3
+
4
+ export function toUserAcquaintanceDTO(
5
+ user: UserEntity,
6
+ isVerified: boolean,
7
+ userProfile: {
8
+ favorites: string[];
9
+ flagged: string[];
10
+ known: string[];
11
+ refresh: string[];
12
+ collections: string[];
13
+ venues: string[];
14
+ friendsCount: number;
15
+ followingCount: number;
16
+ followersCount: number;
17
+ mutualFriendsCount: number;
18
+ }
19
+ ): UserAcquaintanceDTO {
20
+ return {
21
+ id: user._id,
22
+ username: user.username || user.name || '',
23
+ image: user.image || '',
24
+ bio: user.bio || '',
25
+ isVerified,
26
+ profile: {
27
+ dances: {
28
+ favorites: userProfile.favorites,
29
+ flagged: userProfile.flagged,
30
+ known: userProfile.known,
31
+ refresh: userProfile.refresh,
32
+ },
33
+ collections: userProfile.collections,
34
+ venues: userProfile.venues,
35
+ friendsCount: userProfile.friendsCount,
36
+ followingCount: userProfile.followingCount,
37
+ followersCount: userProfile.followersCount,
38
+ mutualFriendsCount: userProfile.mutualFriendsCount,
39
+ links: user.links ?? {},
40
+ },
41
+ };
42
+ }
@@ -0,0 +1,36 @@
1
+ import { ChoreographerDTO } from "../../types/dto/choreographer.dto";
2
+ import { CollectionDTO } from "../../types/dto/collection.dto";
3
+ import { DanceDTO } from "../../types/dto/dance.dto";
4
+ import { TrackDTO } from "../../types/dto/track.dto";
5
+ import { UserAcquaintanceDTO } from "../../types/dto/userAcquaintance.dto";
6
+ import { UserAcquaintanceModel } from "../../types/model/userAcquaintance.model";
7
+ import { toCollectionModel } from "./toCollectionsModel";
8
+ import { toDanceModel } from "./toDanceModel";
9
+
10
+ export function toUserAcquaintanceModel(
11
+ dto: UserAcquaintanceDTO,
12
+ danceMap: Record<string, DanceDTO>,
13
+ trackMap: Record<string, TrackDTO>,
14
+ collectionMap: Record<string, CollectionDTO>,
15
+ choreographerMap: Record<string, ChoreographerDTO>
16
+ ): UserAcquaintanceModel {
17
+
18
+ return {
19
+ id: dto.id,
20
+ username: dto.username,
21
+ image: dto.image,
22
+ bio: dto.bio,
23
+ isVerified: dto.isVerified,
24
+ friendsCount: dto.profile.friendsCount,
25
+ followersCount: dto.profile.followersCount,
26
+ mutualFriendsCount: dto.profile.mutualFriendsCount,
27
+ links: dto.profile.links,
28
+ dances: {
29
+ favorites: dto.profile.dances.favorites.map(id => toDanceModel(danceMap[id], trackMap, choreographerMap)),
30
+ flagged: dto.profile.dances.flagged.map(id => toDanceModel(danceMap[id], trackMap, choreographerMap)),
31
+ known: dto.profile.dances.known.map(id => toDanceModel(danceMap[id], trackMap, choreographerMap)),
32
+ refresh: dto.profile.dances.refresh.map(id => toDanceModel(danceMap[id], trackMap, choreographerMap))
33
+ },
34
+ collections: dto.profile.collections.map(id => toCollectionModel(collectionMap[id], danceMap, trackMap, choreographerMap)),
35
+ };
36
+ }
@@ -0,0 +1,41 @@
1
+ import { UserDTO } from "../../types/dto/user.dto";
2
+ import { UserEntity } from "../../types/entities/user.entity";
3
+
4
+ export function toUserDTO(
5
+ user: UserEntity,
6
+ isVerified: boolean,
7
+ danceIds: {
8
+ favorites: string[];
9
+ flagged: string[];
10
+ known: string[];
11
+ refresh: string[];
12
+ },
13
+ collections: string[],
14
+ venues: string[] = [],
15
+ friends: string[] = [],
16
+ following: string[] = [],
17
+ friendsRequested: string[] = [],
18
+ friendRequests: string[] = []
19
+ ): UserDTO {
20
+ return {
21
+ _id: user._id.toString(),
22
+ email: user.email ?? '',
23
+ name: user.name ?? '',
24
+ username: user.username ?? '',
25
+ image: user.image ?? '',
26
+ bio: user.bio ?? '',
27
+ isVerified,
28
+ profile: {
29
+ danceIds,
30
+ collections,
31
+ venues,
32
+ friends,
33
+ following,
34
+ links: user.links ?? {},
35
+ friendsRequested,
36
+ friendRequests
37
+ },
38
+ };
39
+ };
40
+
41
+ export default toUserDTO;
@@ -0,0 +1,43 @@
1
+ import { UserDTO } from "../../types/dto/user.dto";
2
+ import { CollectionModel } from "../../types/model/collection.model";
3
+ import { DanceModel } from "../../types/model/dance.model";
4
+ import { UserModel } from "../../types/model/user.model";
5
+ import { UserAcquaintanceModel } from "../../types/model/userAcquaintance.model";
6
+ import { VenueModel } from "../../types/model/venue.model";
7
+
8
+ export function toUserModel(
9
+ userDTO: UserDTO,
10
+ danceMap: Record<string, DanceModel>,
11
+ collectionMap: Record<string, CollectionModel>,
12
+ venueMap: Record<string, VenueModel>,
13
+ friendsMap: Record<string, UserAcquaintanceModel>,
14
+ followingMap: Record<string, UserAcquaintanceModel>
15
+ ): UserModel {
16
+ const expand = <T>(ids: string[], map: Record<string, T>): T[] => ids.map(id => map[id]).filter(Boolean);
17
+
18
+ return {
19
+ _id: userDTO._id,
20
+ email: userDTO.email,
21
+ name: userDTO.name,
22
+ username: userDTO.username,
23
+ image: userDTO.image,
24
+ bio: userDTO.bio,
25
+ isVerified: userDTO.isVerified,
26
+ profile: {
27
+ dances: {
28
+ favorites: expand(userDTO.profile.danceIds.favorites, danceMap),
29
+ flagged: expand(userDTO.profile.danceIds.flagged, danceMap),
30
+ known: expand(userDTO.profile.danceIds.known, danceMap),
31
+ refresh: expand(userDTO.profile.danceIds.refresh, danceMap),
32
+ },
33
+ collections: expand(userDTO.profile.collections, collectionMap),
34
+ venues: expand(userDTO.profile.venues, venueMap),
35
+ friends: expand(userDTO.profile.friends, friendsMap),
36
+ following: expand(userDTO.profile.following, followingMap),
37
+ friendsRequested: expand(userDTO.profile.friendsRequested, friendsMap),
38
+ friendRequests: expand(userDTO.profile.friendRequests, friendsMap),
39
+ followersCount: userDTO.profile.followersCount || 0,
40
+ links: userDTO.profile.links,
41
+ },
42
+ };
43
+ }
@@ -0,0 +1,26 @@
1
+ import { VenueDTO } from "../../types/dto/venue.dto";
2
+ import { VenueEntity } from "../../types/entities/venue.entity";
3
+
4
+ export function toVenueDTO(
5
+ venue: VenueEntity,
6
+ lessonIds: string[],
7
+ isVerified: boolean
8
+ ): VenueDTO {
9
+
10
+ return {
11
+ id: venue._id,
12
+ venuename: venue.venuename,
13
+ venueaddress: venue.venueaddress,
14
+ geolocation: venue.geolocation,
15
+ phone: venue.phone,
16
+ website: venue.website,
17
+ contactEmail: venue.contactEmail,
18
+ contactName: venue.contactName,
19
+ contactPhone: venue.contactPhone,
20
+ lessonsIds: lessonIds,
21
+ isVerified: isVerified,
22
+ isDeleted: venue.isDeleted ?? false,
23
+ deletedAt: venue.deletedAt ?? null,
24
+ createdAt: venue.createdAt ?? null,
25
+ };
26
+ }
@@ -0,0 +1,20 @@
1
+ import { InstructorDTO } from "../../types/dto/instructor.dto";
2
+ import { LessonDTO } from "../../types/dto/lesson.dto";
3
+ import { VenueDTO } from "../../types/dto/venue.dto";
4
+ import { VenueModel } from "../../types/model/venue.model";
5
+ import { toLessonModel } from "./toLessonModel";
6
+
7
+ export function toVenueModel(
8
+ venueDTO: VenueDTO,
9
+ lessonMap: Record<string, LessonDTO>,
10
+ instructorMap: Record<string, InstructorDTO>
11
+ ): VenueModel {
12
+ const expandedLessons = venueDTO.lessonsIds
13
+ .map(id => toLessonModel(lessonMap[id], instructorMap))
14
+ .filter(Boolean);
15
+
16
+ return {
17
+ ...venueDTO,
18
+ lessons: expandedLessons,
19
+ };
20
+ }
@@ -1,4 +1,5 @@
1
1
  export interface LessonDTO {
2
+ id: string;
2
3
  lessonday: string;
3
4
  lessonstart: string;
4
5
  instructors: string[];
@@ -0,0 +1,8 @@
1
+ export interface AppealChoreographerUser {
2
+ userId: string;
3
+ choreographerId: string;
4
+ phoneNumber: string;
5
+ email: string;
6
+ createdAt: Date;
7
+ resolved: boolean;
8
+ }
@@ -0,0 +1,8 @@
1
+ export interface AppealInstructorUser {
2
+ userId: string;
3
+ instructorId: string;
4
+ phoneNumber: string;
5
+ email: string;
6
+ createdAt: Date;
7
+ resolved: boolean;
8
+ }
@@ -0,0 +1,6 @@
1
+ export interface CancelledLessonEntity {
2
+ _id?: string;
3
+ lessonId: string;
4
+ date: Date;
5
+ createdAt: Date;
6
+ }
@@ -0,0 +1,5 @@
1
+ export interface ChoreographerEntity {
2
+ _id: string;
3
+ associatedUserId: string;
4
+ name: string;
5
+ }
@@ -0,0 +1,9 @@
1
+ export interface DanceEntity {
2
+ _id: string;
3
+ danceName: string;
4
+ choreographers: string[];
5
+ stepsheet: string;
6
+ difficulty: string;
7
+ primaryTrack: string;
8
+ tracks: string[];
9
+ }
@@ -0,0 +1,8 @@
1
+ export interface DanceCollectionEntity {
2
+ _id: string;
3
+ name: string;
4
+ danceIds: string[];
5
+ createdBy: string;
6
+ createdAt: Date;
7
+ isPrivate: boolean;
8
+ }
@@ -0,0 +1,7 @@
1
+ export interface FriendRequestEntity {
2
+ _id: string;
3
+ requesterId: string;
4
+ requesteeId: string;
5
+ status: 'pending' | 'accepted' | 'declined';
6
+ createdAt: Date;
7
+ }
@@ -0,0 +1,5 @@
1
+ export interface InstructorEntity {
2
+ _id: string;
3
+ name: string;
4
+ associatedUserId: string | null;
5
+ }
@@ -0,0 +1,13 @@
1
+ export interface LessonEntity {
2
+ _id: string;
3
+ venueid: string;
4
+ title: string;
5
+ description: string;
6
+ lessonday: string;
7
+ lessonstart: string;
8
+ instructors: string[];
9
+ duration: string;
10
+ lessoncost: string;
11
+ notes: string;
12
+ difficulty: string;
13
+ }
@@ -0,0 +1,9 @@
1
+ export interface TrackEntity {
2
+ _id: string;
3
+ name: string;
4
+ artists: string[];
5
+ isrc: string;
6
+ uri: string;
7
+ duration_ms: number;
8
+ explicit: boolean;
9
+ }