Last active
May 7, 2021 21:44
-
-
Save ktutnik/ed38a16d1d48d9c72701e6bf29d33573 to your computer and use it in GitHub Desktop.
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
@genericController() | |
@Entity() | |
export class Shop { | |
@PrimaryGeneratedColumn() | |
id: number | |
/** ------ other properties ------ **/ | |
@authorize.readonly() | |
@Column() | |
createdBy:User | |
@preSave("post") | |
assignCreatedBy(@bind.user() user:JwtClaims){ | |
// @bind.user() is the same as ctx.user | |
// is the JWT claims of Authorization request header | |
this.createdBy = { id: user.userId } as User | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment