-
-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create new entity Service Account
creating a join table with users and modify Users accordingly\n add a type column to user table
- Loading branch information
1 parent
3a8b265
commit 66b5aad
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {BaseEntity, Column, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn} from "typeorm"; | ||
import { User } from './User'; | ||
|
||
@Entity({name: 'service_accounts'}) | ||
export class ServiceAccount extends BaseEntity { | ||
|
||
@PrimaryGeneratedColumn() | ||
public id: number; | ||
|
||
|
||
@Column({type: String}) | ||
public description: string; | ||
|
||
@Column({type: Date, default: Date.now()}) | ||
public endOfLife: string; | ||
|
||
@ManyToOne(type => User) | ||
@JoinTable({ | ||
name: 'service_account_user', | ||
joinColumn: {name: 'service_account_id'}, | ||
inverseJoinColumn: {name: 'user_id'} | ||
}) | ||
public service_account_owner: User; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters