add project creation and listing

This commit is contained in:
João Geonizeli
2022-07-09 10:05:01 -03:00
parent c3fe6e6f1c
commit e0dd6c2307
27 changed files with 256 additions and 26 deletions

View File

@@ -0,0 +1,18 @@
import { IsNotEmpty } from "class-validator"
import { Entity, PrimaryGeneratedColumn, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm"
import { User } from "./user.entity"
@Entity()
export class Project {
@PrimaryGeneratedColumn()
id: number
@Column()
@IsNotEmpty()
name: string
@ManyToOne((_type) => User, (user) => user.projects)
@JoinColumn()
@IsNotEmpty()
user: User
}