-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add category aggregate, category repository, list and create us…
…e case
- Loading branch information
1 parent
1c3cec2
commit 77d3bd4
Showing
42 changed files
with
1,658 additions
and
256 deletions.
There are no files selected for viewing
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
21 changes: 21 additions & 0 deletions
21
src/@core/@seedwork/application/dto/pagination-output.dto.spec.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,21 @@ | ||
import { SearchResult } from "../../domain/repository/repository-contracts"; | ||
import { PaginationOutputDto } from "./pagination-output.dto"; | ||
|
||
describe("PaginationOuputDto Unit Tests", () => { | ||
it("should convert SearchResult to PaginationOutputDto", () => { | ||
const searchResult = new SearchResult({ | ||
items: [], | ||
total: 10, | ||
current_page: 2, | ||
per_page: 2, | ||
}); | ||
|
||
const dto = PaginationOutputDto.fromRepoSearchResult(searchResult); | ||
expect(dto).toStrictEqual({ | ||
total: 10, | ||
current_page: 2, | ||
per_page: 2, | ||
last_page: 5, | ||
}); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
src/@core/@seedwork/application/dto/pagination-output.dto.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,19 @@ | ||
import { SearchResult } from "../../domain/repository/repository-contracts"; | ||
|
||
export class PaginationOutputDto { | ||
total: number; | ||
current_page: number; | ||
last_page: number; | ||
per_page: number; | ||
|
||
static fromRepoSearchResult( | ||
result: SearchResult | ||
): PaginationOutputDto { | ||
return { | ||
total: result.total, | ||
current_page: result.current_page, | ||
per_page: result.per_page, | ||
last_page: result.last_page, | ||
}; | ||
} | ||
} |
This file was deleted.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default class InvalidUuidError extends Error { | ||
constructor() { | ||
super('ID must be a valid UUID'); | ||
this.name = 'InvalidUuidError'; | ||
} | ||
} | ||
|
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,6 @@ | ||
import Entity from "./entity/entity"; | ||
|
||
export default interface Mapper<E extends Entity, P> { | ||
toEntity(persistence: P): E; | ||
toPersistence(t: E): P; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.