-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
IngredientCategoriesController
- Loading branch information
1 parent
e7e25ad
commit 958c9ad
Showing
9 changed files
with
60 additions
and
6 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
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
2 changes: 2 additions & 0 deletions
2
apps/your-burger-api/src/app/burger-business/domain/ingredient/ingredients.repository.ts
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { Ingredient } from './ingredient'; | ||
import { IngredientCategory } from './ingredient-category'; | ||
|
||
export abstract class IngredientsRepository { | ||
abstract find(): Promise<Ingredient[]>; | ||
abstract findCategories(): Promise<IngredientCategory[]>; | ||
abstract create(ingredient: Ingredient): Promise<Ingredient>; | ||
} |
16 changes: 16 additions & 0 deletions
16
...ger-api/src/app/burger-business/infra/http/ingredient/ingredient-categories.controller.ts
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,16 @@ | ||
import { Controller, Get } from '@nestjs/common'; | ||
import { IngredientsRepository } from '../../../domain/ingredient/ingredients.repository'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
import { API_TAGS } from '../../../../../open-api'; | ||
import { IngredientCategory } from '../../../domain/ingredient/ingredient-category'; | ||
|
||
@Controller('ingredients/categories') | ||
@ApiTags(API_TAGS.INGREDIENTS) | ||
export class IngredientCategoriesController { | ||
constructor(private readonly ingredientsRepository: IngredientsRepository) {} | ||
|
||
@Get() | ||
public async getIngredients(): Promise<IngredientCategory[]> { | ||
return this.ingredientsRepository.findCategories(); | ||
} | ||
} |
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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