Skip to content

Commit

Permalink
Revert "Release v2.1.1 (#178)"
Browse files Browse the repository at this point in the history
This reverts commit cc623c4.
  • Loading branch information
anjula-sack authored Oct 31, 2024
1 parent cc623c4 commit a95a74f
Show file tree
Hide file tree
Showing 20 changed files with 30 additions and 515 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"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",
"migration:revert": "npm run typeorm:db -- migration:revert",
"sync:db": "npm run typeorm:db schema:sync",
"seed": "npm run build && node dist/src/scripts/seed-db.js"
},
Expand Down
6 changes: 1 addition & 5 deletions src/controllers/admin/mentor.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ export const updateMentorHandler = async (

const mentorUpdateData: Partial<Mentor> = { ...data }
const profileUpdateData: Partial<Profile> = { ...data.profile }
const categoryId: string = data.categoryId
const countryId: string = data.countryId

if (req.file) {
profileUpdateData.image_url = `${IMG_HOST}/${req.file.filename}`
Expand All @@ -63,9 +61,7 @@ export const updateMentorHandler = async (
const { mentor, statusCode, message } = await updateMentorDetails(
mentorId,
mentorUpdateData,
profileUpdateData,
categoryId,
countryId
profileUpdateData
)
return res.status(statusCode).json({ mentor, message })
} catch (err) {
Expand Down
5 changes: 2 additions & 3 deletions src/controllers/mentor.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ export const mentorApplicationHandler = async (
): Promise<ApiResponse<Mentor>> => {
try {
const user = req.user as Profile
const { application, categoryId, countryId } = req.body
const { application, categoryId } = req.body

const { mentor, statusCode, message } = await createMentor(
user,
application,
categoryId,
countryId
categoryId
)

return res.status(statusCode).json({ mentor, message })
Expand Down
95 changes: 0 additions & 95 deletions src/controllers/monthlyChecking.controller.ts

This file was deleted.

63 changes: 0 additions & 63 deletions src/entities/checkin.entity.ts

This file was deleted.

6 changes: 1 addition & 5 deletions src/entities/country.entity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Column, Entity, OneToMany } from 'typeorm'
import { Column, Entity } from 'typeorm'
import BaseEntity from './baseEntity'
import Mentor from './mentor.entity'

@Entity()
export class Country extends BaseEntity {
Expand All @@ -10,9 +9,6 @@ export class Country extends BaseEntity {
@Column()
name: string

@OneToMany(() => Mentor, (mentor) => mentor.country)
mentors?: Mentor[]

constructor(code: string, name: string) {
super()
this.code = code
Expand Down
10 changes: 2 additions & 8 deletions src/entities/mentee.entity.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Column, Entity, ManyToOne, OneToMany } from 'typeorm'
import { Column, Entity, ManyToOne } from 'typeorm'
import Mentor from './mentor.entity'
import profileEntity from './profile.entity'
import { MenteeApplicationStatus, StatusUpdatedBy } from '../enums'
import BaseEntity from './baseEntity'
import { UUID } from 'typeorm/driver/mongodb/bson.typings'
import MonthlyCheckIn from './checkin.entity'

@Entity('mentee')
class Mentee extends BaseEntity {
Expand Down Expand Up @@ -36,22 +35,17 @@ class Mentee extends BaseEntity {
@ManyToOne(() => Mentor, (mentor) => mentor.mentees)
mentor: Mentor

@OneToMany(() => MonthlyCheckIn, (checkIn) => checkIn.mentee)
checkIns?: MonthlyCheckIn[]

constructor(
state: MenteeApplicationStatus,
application: Record<string, unknown>,
profile: profileEntity,
mentor: Mentor,
checkIns?: MonthlyCheckIn[]
mentor: Mentor
) {
super()
this.state = state || MenteeApplicationStatus.PENDING
this.application = application
this.profile = profile
this.mentor = mentor
this.checkIns = checkIns
}
}

Expand Down
9 changes: 1 addition & 8 deletions src/entities/mentor.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Mentee from './mentee.entity'
import Category from './category.entity'
import { MentorApplicationStatus } from '../enums'
import BaseEntity from './baseEntity'
import { Country } from './country.entity'

@Entity('mentor')
class Mentor extends BaseEntity {
Expand All @@ -29,10 +28,6 @@ class Mentor extends BaseEntity {
@JoinColumn()
profile: Profile

@ManyToOne(() => Country, (country) => country.mentors)
@JoinColumn()
country: Country

@OneToMany(() => Mentee, (mentee) => mentee.mentor)
mentees?: Mentee[]

Expand All @@ -41,16 +36,14 @@ class Mentor extends BaseEntity {
category: Category,
application: Record<string, unknown>,
availability: boolean,
profile: Profile,
country: Country
profile: Profile
) {
super()
this.state = state
this.category = category
this.application = application
this.availability = availability
this.profile = profile
this.country = country
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,14 @@ export class RemoveUniqueConstraintFromProfileUuid1722051742722
name = 'RemoveUniqueConstraintFromProfileUuid1722051742722'

public async up(queryRunner: QueryRunner): Promise<void> {
// Check if the constraint exists before attempting to drop it
const constraintExists = await queryRunner.query(`
SELECT 1
FROM information_schema.table_constraints
WHERE constraint_name = 'REL_f671cf2220d1bd0621a1a5e92e'
AND table_name = 'mentee'
`)

if (constraintExists.length > 0) {
await queryRunner.query(
`ALTER TABLE "mentee" DROP CONSTRAINT "REL_f671cf2220d1bd0621a1a5e92e"`
)
}

await queryRunner.query(
`ALTER TABLE "mentee" DROP CONSTRAINT "FK_f671cf2220d1bd0621a1a5e92e7"`
)
await queryRunner.query(
`ALTER TABLE "mentee" ADD CONSTRAINT "FK_f671cf2220d1bd0621a1a5e92e7" FOREIGN KEY ("profileUuid") REFERENCES "profile"("uuid") ON DELETE CASCADE ON UPDATE NO ACTION`
`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`
)
}

Expand Down
21 changes: 0 additions & 21 deletions src/migrations/1726930041488-UpdateMentorTableWithCountry.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/migrations/1727197270336-monthly-checking-tags.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/migrations/1727636762101-monthlychecking.ts

This file was deleted.

Loading

0 comments on commit a95a74f

Please sign in to comment.