Skip to content

Commit 745cf36

Browse files
committed
Typescript Bootcamp
1 parent e71ef82 commit 745cf36

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

rest-api/src/data-source.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {DataSource} from "typeorm";
22
import {Course} from "./models/course";
33
import {Lesson} from "./models/lesson";
4+
import {User} from "./models/user";
45

56

67
export const AppDataSource = new DataSource({
@@ -18,7 +19,8 @@ export const AppDataSource = new DataSource({
1819
},
1920
entities: [
2021
Course,
21-
Lesson
22+
Lesson,
23+
User
2224
],
2325
synchronize: true,
2426
logging:true

rest-api/src/models/user.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import {Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn} from "typeorm";
2+
3+
4+
@Entity({
5+
name: "USERS"
6+
})
7+
export class User {
8+
9+
@PrimaryGeneratedColumn()
10+
id:number;
11+
12+
@Column()
13+
email:string;
14+
15+
@Column()
16+
passwordHash:string;
17+
18+
@Column()
19+
pictureUrl:string;
20+
21+
@Column()
22+
isAdmin:boolean;
23+
24+
@CreateDateColumn()
25+
createdAt: Date;
26+
27+
@UpdateDateColumn()
28+
lastUpdatedAt: Date;
29+
}

0 commit comments

Comments
 (0)