-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a091ac0
commit b9b56a3
Showing
16 changed files
with
205 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
services/api/src/modules/study/domain/entities/coursables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { generateDefaultUser } from '@modules/users' | ||
import { BaseEntity } from 'equipped' | ||
import { CoursableData, Publishable } from '../types' | ||
|
||
export class PublishableEntity extends BaseEntity implements Publishable { | ||
public readonly id: string | ||
public readonly title: Publishable['title'] | ||
public readonly description: Publishable['description'] | ||
public readonly photo: Publishable['photo'] | ||
public readonly user: Publishable['user'] | ||
public readonly topicId: Publishable['topicId'] | ||
public readonly tagIds: Publishable['tagIds'] | ||
public readonly status: Publishable['status'] | ||
public readonly ratings: Publishable['ratings'] | ||
public readonly createdAt: number | ||
public readonly updatedAt: number | ||
|
||
constructor ({ id, title, description, photo, user, topicId, tagIds, ratings, status, createdAt, updatedAt }: PublishableConstructorArgs) { | ||
super() | ||
this.id = id | ||
this.title = title | ||
this.description = description | ||
this.photo = photo | ||
this.user = generateDefaultUser(user) | ||
this.topicId = topicId | ||
this.tagIds = tagIds | ||
this.ratings = ratings | ||
this.status = status | ||
this.createdAt = createdAt | ||
this.updatedAt = updatedAt | ||
} | ||
} | ||
|
||
type PublishableConstructorArgs = Publishable & { | ||
id: string | ||
createdAt: number | ||
updatedAt: number | ||
} | ||
|
||
export class CoursableEntity extends PublishableEntity implements CoursableData { | ||
public readonly courseId: string | null | ||
|
||
constructor (data: PublishableConstructorArgs & { courseId: string | null }) { | ||
super(data) | ||
this.courseId = data.courseId | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 11 additions & 33 deletions
44
services/api/src/modules/study/domain/entities/quizzes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.