File tree Expand file tree Collapse file tree 5 files changed +58
-0
lines changed
Expand file tree Collapse file tree 5 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ import { LoginDto } from 'src/application/dtos/login-user.dto' ;
2+ import { UserDto } from 'src/application/dtos/user.dto' ;
3+ export interface AuthInterface {
4+ validateUser ( email : string , password : string ) : Promise < UserDto | null > ;
5+ login ( user : LoginDto ) : Promise < { access_token : string } > ;
6+ }
Original file line number Diff line number Diff line change 1+ import { User } from './user.entity' ;
2+
3+ export class Recipe {
4+ constructor (
5+ public id : number ,
6+ public title : string ,
7+ public ingredients : string ,
8+ public instructions : string ,
9+ public createdAt : Date ,
10+ public updatedAt ?: Date ,
11+ public user ?: User ,
12+ ) { }
13+ }
Original file line number Diff line number Diff line change 1+ import { Recipe } from './recipe.entity' ;
2+
3+ export class User {
4+ constructor (
5+ public id : number ,
6+ public username : string ,
7+ public email : string ,
8+ public password : string ,
9+ public salt : string ,
10+ public createdAt ?: Date ,
11+ public updatedAt ?: Date ,
12+ public recipes ?: Recipe [ ] ,
13+ ) { }
14+ }
Original file line number Diff line number Diff line change 1+ import { RecipeDto } from 'src/application/dtos/recipe.dto' ;
2+ import { RecipeORMEntity } from 'src/infrastructure/database/typeorm/recipe.orm-entity' ;
3+
4+ export interface RecipeRepository {
5+ findAll ( ) : Promise < RecipeDto [ ] > ;
6+ findById ( id : number ) : Promise < RecipeDto | null > ;
7+ create ( recipe : RecipeDto ) : Promise < RecipeDto > ;
8+ update ( data : RecipeORMEntity ) : Promise < RecipeDto | null > ;
9+ delete ( id : number ) : Promise < void > ;
10+ }
Original file line number Diff line number Diff line change 1+ import { CreateUserDto } from 'src/application/dtos/create-user.dto' ;
2+ import { updateUserDto } from 'src/application/dtos/update-user.dto' ;
3+ import { UserDto } from 'src/application/dtos/user.dto' ;
4+
5+ export interface UserRepository {
6+ create ( user : CreateUserDto ) : Promise < UserDto > ;
7+ update ( user : updateUserDto ) : Promise < UserDto | null > ;
8+ delete ( id : number ) : Promise < void > ;
9+ getMe ( id : number ) : Promise < UserDto | null > ;
10+ findbyEmail ( email : string ) : Promise < UserDto | null > ;
11+ comparePassword (
12+ plainPassword : string ,
13+ hashedPassword : string ,
14+ ) : Promise < boolean > ;
15+ }
You can’t perform that action at this time.
0 commit comments