Skip to content

Commit 0c7d90c

Browse files
interfaces realocated
1 parent 0dddaa8 commit 0c7d90c

File tree

5 files changed

+58
-0
lines changed

5 files changed

+58
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
}

0 commit comments

Comments
 (0)