Skip to content

Commit

Permalink
feat :: 수강신청 엔티티 추가
Browse files Browse the repository at this point in the history
feat :: 수강신청 엔티티 추가
  • Loading branch information
Woonseok105 authored Dec 28, 2023
2 parents b6935b6 + bd68ae8 commit 0165a41
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { UserModule } from './domain/user/user.module';
import { CourseModule } from './domain/course/course.module';
import { ConfigModule } from '@nestjs/config';
import { LectureModule } from './domain/lecture/lecture.module';
import { ClassRegistrationModule } from './domain/classRegistration/classRegistration.module';

@Module({
imports: [
Expand All @@ -13,6 +14,7 @@ import { LectureModule } from './domain/lecture/lecture.module';
UserModule,
LectureModule,
CourseModule,
ClassRegistrationModule,
ConfigModule.forRoot({ isGlobal: true })
]
})
Expand Down
23 changes: 23 additions & 0 deletions src/domain/classRegistration/classRegistration.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Entity, ManyToOne, PrimaryColumn } from 'typeorm';
import { LectureEntity } from '../lecture/lecture.entity';
import { UserEntity } from '../user/user.entity';

@Entity('tbl_class_registration')
export class ClassRegistrationEntity {
@ManyToOne(() => UserEntity, (user) => user, {
onDelete: 'CASCADE'
})
@PrimaryColumn('varchar', { name: 'user_id' })
user: UserEntity;

@ManyToOne(() => LectureEntity, (lecture) => lecture, {
onDelete: 'CASCADE'
})
@PrimaryColumn('varchar', { name: 'lecture_id' })
lecture: LectureEntity;

constructor(user: UserEntity, lecture: LectureEntity) {
this.user = user;
this.lecture = lecture;
}
}
13 changes: 13 additions & 0 deletions src/domain/classRegistration/classRegistration.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { TypeOrmModule } from '@nestjs/typeorm';
import { ClassRegistrationEntity } from './classRegistration.entity';
import { Global, Module } from '@nestjs/common';

const CLASS_REGISTRATION_REPOSITORY = TypeOrmModule.forFeature([ClassRegistrationEntity]);

@Global()
@Module({
imports: [CLASS_REGISTRATION_REPOSITORY],
exports: [CLASS_REGISTRATION_REPOSITORY]
})
export class ClassRegistrationModule {
}

0 comments on commit 0165a41

Please sign in to comment.