-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the data models #46
Conversation
src/entity/email.entity.ts
Outdated
content: string | ||
// Should be ENUM | ||
@Column() | ||
state: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's create an enum type
|
||
@UpdateDateColumn() | ||
updated_at: Date | undefined | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mente, mentor relationship
@ManyToOne(() => Mentor, mentor => mentor.mentees)
mentor: Mentor;
|
||
@UpdateDateColumn() | ||
updated_at: Date | undefined | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OneToMany(() => Mentee, mentee => mentee.mentor)
mentees: Mentee[];
src/entity/mentor.entity.ts
Outdated
state: string | ||
// Should be Enum | ||
@Column() | ||
category: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this has a relationship. one to many with category
can you add the program entity as well @kumuditha-udayanga |
src/entity/mentee.entity.ts
Outdated
|
||
@Entity('mentee') | ||
class Mentee { | ||
@PrimaryGeneratedColumn() | ||
id!: bigint | ||
|
||
@Column({type: "enum"}) | ||
@Column() | ||
state: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a enum. PENDING, REJECTED, ACCEPTED
src/entity/mentor.entity.ts
Outdated
state: string | ||
// Should be Enum | ||
@Column() | ||
category: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this has a relationship. one to many with category
716eb4d
to
2ca05fe
Compare
category: string, | ||
) { | ||
this.category = category; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
@BeforeInsert() | |
@BeforeUpdate() | |
updateTimestamps() { | |
this.updated_at = new Date(); | |
if (!this.uuid) { | |
this.created_at = new Date(); | |
} | |
} | |
@BeforeInsert() | |
async generateUuid() { | |
if (!this.uuid) { | |
this.uuid = uuidv4(); | |
} | |
} |
src/entity/category.entity.ts
Outdated
@Entity("category") | ||
class Category { | ||
@PrimaryGeneratedColumn('uuid') | ||
id!: bigint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id!: bigint | |
uuid!: bigint | |
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) | |
created_at: Date | undefined; | |
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) | |
updated_at: Date | undefined; |
src/entity/email.entity.ts
Outdated
@Entity("email") | ||
class Email { | ||
@PrimaryGeneratedColumn('uuid') | ||
id!: bigint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id!: bigint | |
uuid!: bigint |
src/entity/email.entity.ts
Outdated
@CreateDateColumn() | ||
created_at: Date | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CreateDateColumn() | |
created_at: Date | undefined | |
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) | |
created_at: Date | undefined; | |
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) | |
updated_at: Date | undefined; |
this.subject = subject; | ||
this.content = content; | ||
this.state = state; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
@BeforeInsert() | |
@BeforeUpdate() | |
updateTimestamps() { | |
this.updated_at = new Date(); | |
if (!this.uuid) { | |
this.created_at = new Date(); | |
} | |
} | |
@BeforeInsert() | |
async generateUuid() { | |
if (!this.uuid) { | |
this.uuid = uuidv4(); | |
} | |
} |
src/entity/mentee.entity.ts
Outdated
@Entity('mentee') | ||
class Mentee { | ||
@PrimaryGeneratedColumn() | ||
id!: bigint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id!: bigint | |
uuid!: bigint |
src/entity/mentor.entity.ts
Outdated
@Entity("mentor") | ||
class Mentor { | ||
@PrimaryGeneratedColumn('uuid') | ||
id!: bigint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id!: bigint | |
uuid!: bigint |
src/entity/mentor.entity.ts
Outdated
@CreateDateColumn() | ||
created_at: Date | undefined | ||
|
||
@UpdateDateColumn() | ||
updated_at: Date | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this just like above,
refer to the existing profile entity
src/entity/platform.entity.ts
Outdated
@Entity("platform") | ||
class Platform { | ||
@PrimaryGeneratedColumn('uuid') | ||
id!: bigint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id!: bigint | |
uuid!: bigint |
@@ -0,0 +1,16 @@ | |||
interface Option { | |||
// todo: To be determined | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
@kumuditha-udayanga can you fix the conflicts? |
Sure @anjula-sack, I'll resolve them as well. |
Hi @kumuditha-udayanga, any updates on this? |
2ca05fe
to
ff80da0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! @kumuditha-udayanga
Purpose
The purpose of this PR is to fix #8
Goals
Approach
Screenshots
Checklist
Related PRs
Test environment
Learning