Skip to content
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

Update mentee schema #142

Merged
merged 1 commit into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"typeorm:db": "npm run build && npx typeorm -d dist/src/configs/dbConfig.js",
"migration:generate": "npm run typeorm:db -- migration:generate",
"migration:run": "npm run typeorm:db -- migration:run",
"sync:db": "npm run typeorm:db schema:sync",
"seed": "npm run build && node dist/src/scripts/seed-db.js"
},
"author": "",
Expand Down
4 changes: 2 additions & 2 deletions src/configs/dbConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DataSource } from 'typeorm'
import { DB_PASSWORD, DB_HOST, DB_PORT, DB_USER, DB_NAME } from './envConfig'
import path from 'path'
import { DataSource } from 'typeorm'
import { DB_HOST, DB_NAME, DB_PASSWORD, DB_PORT, DB_USER } from './envConfig'

export const dataSource = new DataSource({
type: 'postgres',
Expand Down
5 changes: 2 additions & 3 deletions src/entities/mentee.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Column, Entity, JoinColumn, ManyToOne, OneToOne } from 'typeorm'
import { Column, Entity, ManyToOne } from 'typeorm'
import Mentor from './mentor.entity'
import profileEntity from './profile.entity'
import { ApplicationStatus, StatusUpdatedBy } from '../enums'
Expand Down Expand Up @@ -28,8 +28,7 @@ class Mentee extends BaseEntity {
@Column({ default: null, nullable: true })
journal!: string

@OneToOne(() => profileEntity)
@JoinColumn()
@ManyToOne(() => profileEntity, (profile) => profile.mentee)
profile: profileEntity

@ManyToOne(() => Mentor, (mentor) => mentor.mentees)
Expand Down
1 change: 0 additions & 1 deletion src/entities/profile.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class Profile extends BaseEntity {
first_name: string,
last_name: string,
image_uri: string,
linkedin_uri: string,
type: ProfileTypes,
password: string
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { type MigrationInterface, type QueryRunner } from 'typeorm'

export class RemoveUniqueConstraintFromProfileUuid1722051742722
implements MigrationInterface
{
name = 'RemoveUniqueConstraintFromProfileUuid1722051742722'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "mentee" DROP CONSTRAINT "FK_f671cf2220d1bd0621a1a5e92e7"`
)
await queryRunner.query(
`ALTER TABLE "mentee" DROP CONSTRAINT "REL_f671cf2220d1bd0621a1a5e92e"`
)
await queryRunner.query(
`ALTER TABLE "mentee" ADD CONSTRAINT "FK_f671cf2220d1bd0621a1a5e92e7" FOREIGN KEY ("profileUuid") REFERENCES "profile"("uuid") ON DELETE NO ACTION ON UPDATE NO ACTION`
)
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "mentee" DROP CONSTRAINT "FK_f671cf2220d1bd0621a1a5e92e7"`
)
await queryRunner.query(
`ALTER TABLE "mentee" ADD CONSTRAINT "REL_f671cf2220d1bd0621a1a5e92e" UNIQUE ("profileUuid")`
)
await queryRunner.query(
`ALTER TABLE "mentee" ADD CONSTRAINT "FK_f671cf2220d1bd0621a1a5e92e7" FOREIGN KEY ("profileUuid") REFERENCES "profile"("uuid") ON DELETE NO ACTION ON UPDATE NO ACTION`
)
}
}
4 changes: 2 additions & 2 deletions src/scripts/seed-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const createRandomProfile = (): Partial<Profile> => {
const createMentor = (category: Category, profile: Profile): Mentor => {
return {
state: faker.helpers.enumValue(ApplicationStatus),
category: category,
category,
application: {
firstName: faker.person.firstName(),
lastName: faker.person.firstName(),
Expand Down Expand Up @@ -154,7 +154,7 @@ const createMentor = (category: Category, profile: Profile): Mentor => {
email: faker.internet.email()
},
availability: faker.datatype.boolean(),
profile: profile
profile
} as unknown as Mentor
}

Expand Down
2 changes: 0 additions & 2 deletions src/services/admin.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('getAllUsers', () => {
'User1',
'Last1',
'image1.jpg',
'linkedin1',
ProfileTypes.DEFAULT,
'hashedPassword1'
)
Expand All @@ -28,7 +27,6 @@ describe('getAllUsers', () => {
'User2',
'Last2',
'image2.jpg',
'linkedin2',
ProfileTypes.ADMIN,
'hashedPassword2'
)
Expand Down
2 changes: 0 additions & 2 deletions src/services/admin/user.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('getAllUsers', () => {
'User1',
'Last1',
'image1.jpg',
'linkedin1',
ProfileTypes.DEFAULT,
'hashedPassword1'
)
Expand All @@ -28,7 +27,6 @@ describe('getAllUsers', () => {
'User2',
'Last2',
'image2.jpg',
'linkedin2',
ProfileTypes.ADMIN,
'hashedPassword2'
)
Expand Down
18 changes: 0 additions & 18 deletions src/templates/emailTemplate.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -170,24 +170,6 @@
>View Dashboard</span
>
</a>
<a
href="https://join.slack.com/t/sefheadquarters/shared_invite/zt-1jwub1lpd-RXYAMG46qXRUhOGZ7u_ewg"
style="
background: #6dca65;
text-decoration: none;
padding: 10px 25px;
margin-bottom: 1rem;
color: #ffffff;
border-radius: 4px;
display: inline-block;
mso-padding-alt: 0;
text-underline-color: #6dca65;
"
>
<span style="mso-text-raise: 10pt; font-weight: bold"
>Join our Slack</span
>
</a>
</p>
</div>
</td>
Expand Down
41 changes: 31 additions & 10 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
subject: string
message: string
}
): any => {

Check warning on line 68 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
const templatePath = path.join(__dirname, 'templates', `${templateName}.ejs`)

return new Promise<string>((resolve, reject) => {
Expand Down Expand Up @@ -98,12 +98,23 @@
subject:
'Congratulations! You have been selected as a ScholarX Mentor',
message: `Dear ${name},<br /><br />
I hope this email finds you in high spirits! I am delighted to inform you that you have been selected as a mentor for ScholarX, and we extend our heartfelt congratulations to you! <br /><br />
We received a large number of qualified applicants, and after a thorough review of all candidates, we are thrilled to invite you to accept a place in our program. Your profile stood out amongst the others, and we are confident that you will contribute positively to our program.<br /><br />
We understand that your hard work and dedication have brought you to this moment, and we recognize your exceptional talent, experience, and potential in your respective fields. We are excited to have you join our community of learners and scholars.<br /><br />
We look forward to seeing the unique perspective and insights you will bring to the mentees and to the program. We believe that you will flourish in this year's edition of ScholarX, and we are thrilled to be a part of your academic or professional journey.<br /><br />
Once again, congratulations on your selection! We cannot wait to have you on board. We will keep you informed on the next steps, and in the meantime would like to invite you to go through some of the resources that would be useful to thrive as a great mentor in ScholarX.`
I hope this email finds you in high spirits! I am delighted to inform you that you have been selected as a mentor for ScholarX, and we extend our heartfelt congratulations to you! <br /><br />
We received a large number of qualified applicants, and after a thorough review of all candidates, we are thrilled to invite you to accept a place in our program. Your profile stood out amongst the others, and we are confident that you will contribute positively to our program.<br /><br />
We understand that your hard work and dedication have brought you to this moment, and we recognize your exceptional talent, experience, and potential in your respective fields. We are excited to have you join our community of learners and scholars.<br /><br />
We look forward to seeing the unique perspective and insights you will bring to the mentees and to the program. We believe that you will flourish in this year's edition of ScholarX, and we are thrilled to be a part of your academic or professional journey.<br /><br />
Once again, congratulations on your selection! We cannot wait to have you on board. We will keep you informed on the next steps, and in the meantime, we would like to invite you to go through some of the resources that would be useful to thrive as a great mentor in ScholarX.<br /><br />
<strong>Important:</strong> To help you get started and to provide all the necessary information you will need, please carefully read the <strong>Mentor Guide</strong>. This guide contains crucial details about the program and your responsibilities. You can access the Mentor Guide using the link below:<br /><br />
<a
href="https://docs.google.com/document/d/1uMMcGWJ35nblOj1zZ1XzJuYm-LOi1Lyj02yYRNsaOkY/edit?usp=sharing"
target="_blank"
rel="noreferrer"
style="display: inline-block; padding: 10px 15px; background-color: #4CAF50; color: white; text-decoration: none; border-radius: 5px; font-weight: bold;"
>
Read the Mentor Guide
</a><br /><br />
Please ensure you review this guide thoroughly to understand the next steps and to prepare for your journey with us.`
}

case ApplicationStatus.REJECTED:
return {
subject: 'Thank You for Your Interest in the ScholarX Program',
Expand All @@ -129,11 +140,21 @@
return {
subject: 'Congratulations! You have been selected for ScholarX',
message: `Dear ${name},<br /><br />
We are delighted to inform you that you have been selected for our undergraduate program, and we extend our heartfelt congratulations to you!<br /><br />
We received a large number of qualified applicants, and after a thorough review of all candidates, we are thrilled to offer you a place in our program. Your application stood out amongst the others, and we are confident that you will contribute positively to our program.<br /><br />
We believe that you have great potential to succeed in your academic and professional pursuits, and we are excited to have you join our community of learners and scholars.<br /><br />
To emphasize the importance of completing the program, you have received a valuable opportunity. If, for any reason, you are uncertain about completing the program within the 6-month timeline, please inform our admissions team as soon as possible, so we can provide the opportunity to another deserving student.<br /><br />
Once again, congratulations on your selection! We cannot wait to have you on board. `
We are delighted to inform you that you have been selected for our undergraduate program, and we extend our heartfelt congratulations to you!<br /><br />
We received a large number of qualified applicants, and after a thorough review of all candidates, we are thrilled to offer you a place in our program. Your application stood out amongst the others, and we are confident that you will contribute positively to our program.<br /><br />
We believe that you have great potential to succeed in your academic and professional pursuits, and we are excited to have you join our community of learners and scholars.<br /><br />
To emphasize the importance of completing the program, you have received a valuable opportunity. If, for any reason, you are uncertain about completing the program within the 6-month timeline, please inform our admissions team as soon as possible, so we can provide the opportunity to another deserving student.<br /><br />
Once again, congratulations on your selection! We cannot wait to have you on board.<br /><br />
<strong>Important:</strong> To help you get started and to provide all the necessary information you will need, please carefully read the <strong>Mentee Guide</strong>. This guide contains crucial details about the program, your responsibilities, and how to make the most of this opportunity. You can access the Mentee Guide using the link below:<br /><br />
<a
href="https://docs.google.com/document/d/1gIYte14FIQtqUhGiMErZRovhNErdUrFdQ0LnCFFnfag/edit?usp=sharing"
target="_blank"
rel="noreferrer"
style="display: inline-block; padding: 10px 15px; background-color: #4CAF50; color: white; text-decoration: none; border-radius: 5px; font-weight: bold;"
>
Read the Mentee Guide
</a><br /><br />
Please ensure you review this guide thoroughly to understand the next steps and to prepare for your journey with us.`
}
case ApplicationStatus.REJECTED:
return {
Expand Down
Loading