-
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.
- Loading branch information
Showing
47 changed files
with
570 additions
and
81 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
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,3 +1,4 @@ | ||
export * from './base-entity' | ||
|
||
export * from './bio-product' | ||
export * from './test-category' |
22 changes: 22 additions & 0 deletions
22
apps/levansy-access-service/src/domain/entity/test-category.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,22 @@ | ||
import { BaseEntity, EntityExample } from './base-entity' | ||
|
||
export type TestCategory = BaseEntity & { | ||
index: number | ||
name: string | ||
reportIndex: number | ||
} | ||
|
||
export const exampleTestCategory: EntityExample<TestCategory> = { | ||
index: { | ||
example: 1, | ||
description: 'thứ tự in trong kết quả', | ||
}, | ||
name: { | ||
example: 'XN Huyết học - Đông máu', | ||
description: 'name', | ||
}, | ||
reportIndex: { | ||
example: 1, | ||
description: 'thứ tự in trong báo cáo', | ||
}, | ||
} |
1 change: 1 addition & 0 deletions
1
apps/levansy-access-service/src/domain/interface/repository/index.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,3 +1,4 @@ | ||
export * from './interface' | ||
|
||
export * from './bio-product' | ||
export * from './test-category' |
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
6 changes: 6 additions & 0 deletions
6
apps/levansy-access-service/src/domain/interface/repository/test-category.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,6 @@ | ||
import { TestCategory } from 'src/domain/entity' | ||
import { IRepository } from './interface' | ||
|
||
export const TestCategoryRepositoryToken = Symbol('TestCategoryRepository') | ||
|
||
export interface ITestCategoryRepository extends IRepository<TestCategory> {} |
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
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
26 changes: 26 additions & 0 deletions
26
apps/levansy-access-service/src/domain/use-case/test-category/create.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,26 @@ | ||
import { Inject, Injectable } from '@nestjs/common' | ||
|
||
import { | ||
TestCategoryRepositoryToken, | ||
ITestCategoryRepository, | ||
} from 'src/domain/interface' | ||
import { TestCategory, EntityData } from 'src/domain/entity' | ||
import { IUseCase } from '../interface' | ||
|
||
export type TestCategoryCreateUseCaseInput = EntityData<TestCategory> | ||
export type TestCategoryCreateUseCaseOutput = TestCategory | ||
|
||
@Injectable() | ||
export class TestCategoryCreateUseCase | ||
implements | ||
IUseCase<TestCategoryCreateUseCaseInput, TestCategoryCreateUseCaseOutput> | ||
{ | ||
constructor( | ||
@Inject(TestCategoryRepositoryToken) | ||
private readonly testCategoryRepository: ITestCategoryRepository, | ||
) {} | ||
|
||
async handle(input: TestCategoryCreateUseCaseInput) { | ||
return this.testCategoryRepository.create(input) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
apps/levansy-access-service/src/domain/use-case/test-category/delete.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,28 @@ | ||
import { Inject, Injectable } from '@nestjs/common' | ||
|
||
import { | ||
TestCategoryRepositoryToken, | ||
ITestCategoryRepository, | ||
} from 'src/domain/interface' | ||
import { TestCategory } from 'src/domain/entity' | ||
import { IUseCase } from '../interface' | ||
|
||
export type TestCategoryDeleteUseCaseInput = { | ||
id: string | ||
} | ||
export type TestCategoryDeleteUseCaseOutput = TestCategory | ||
|
||
@Injectable() | ||
export class TestCategoryDeleteUseCase | ||
implements | ||
IUseCase<TestCategoryDeleteUseCaseInput, TestCategoryDeleteUseCaseOutput> | ||
{ | ||
constructor( | ||
@Inject(TestCategoryRepositoryToken) | ||
private readonly testCategoryRepository: ITestCategoryRepository, | ||
) {} | ||
|
||
handle(input: TestCategoryDeleteUseCaseInput) { | ||
return this.testCategoryRepository.deleteById(input.id) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
apps/levansy-access-service/src/domain/use-case/test-category/find-by-id.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,31 @@ | ||
import { Inject, Injectable } from '@nestjs/common' | ||
|
||
import { | ||
TestCategoryRepositoryToken, | ||
ITestCategoryRepository, | ||
} from 'src/domain/interface' | ||
import { TestCategory } from 'src/domain/entity' | ||
import { IUseCase } from '../interface' | ||
|
||
export type TestCategoryFindByIdUseCaseInput = { | ||
id: string | ||
} | ||
export type TestCategoryFindByIdUseCaseOutput = TestCategory | null | ||
|
||
@Injectable() | ||
export class TestCategoryFindByIdUseCase | ||
implements | ||
IUseCase< | ||
TestCategoryFindByIdUseCaseInput, | ||
TestCategoryFindByIdUseCaseOutput | ||
> | ||
{ | ||
constructor( | ||
@Inject(TestCategoryRepositoryToken) | ||
private readonly testCategoryRepository: ITestCategoryRepository, | ||
) {} | ||
|
||
handle(input: TestCategoryFindByIdUseCaseInput) { | ||
return this.testCategoryRepository.findById(input.id) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
apps/levansy-access-service/src/domain/use-case/test-category/search.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,28 @@ | ||
import { Inject, Injectable } from '@nestjs/common' | ||
|
||
import { | ||
TestCategoryRepositoryToken, | ||
ITestCategoryRepository, | ||
SearchOptions, | ||
SearchResult, | ||
} from 'src/domain/interface' | ||
import { TestCategory } from 'src/domain/entity' | ||
import { IUseCase } from '../interface' | ||
|
||
export type TestCategorySearchUseCaseInput = SearchOptions<TestCategory> | ||
export type TestCategorySearchUseCaseOutput = SearchResult<TestCategory> | ||
|
||
@Injectable() | ||
export class TestCategorySearchUseCase | ||
implements | ||
IUseCase<TestCategorySearchUseCaseInput, TestCategorySearchUseCaseOutput> | ||
{ | ||
constructor( | ||
@Inject(TestCategoryRepositoryToken) | ||
private readonly testCategoryRepository: ITestCategoryRepository, | ||
) {} | ||
|
||
handle(input: TestCategorySearchUseCaseInput) { | ||
return this.testCategoryRepository.search(input) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
apps/levansy-access-service/src/domain/use-case/test-category/update.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,31 @@ | ||
import { Inject, Injectable } from '@nestjs/common' | ||
|
||
import { | ||
TestCategoryRepositoryToken, | ||
ITestCategoryRepository, | ||
} from 'src/domain/interface' | ||
import { TestCategory, EntityData } from 'src/domain/entity' | ||
import { IUseCase } from '../interface' | ||
|
||
export type TestCategoryUpdateUseCaseInput = Partial< | ||
EntityData<TestCategory> | ||
> & { | ||
id: string | ||
} | ||
export type TestCategoryUpdateUseCaseOutput = TestCategory | null | ||
|
||
@Injectable() | ||
export class TestCategoryUpdateUseCase | ||
implements | ||
IUseCase<TestCategoryUpdateUseCaseInput, TestCategoryUpdateUseCaseOutput> | ||
{ | ||
constructor( | ||
@Inject(TestCategoryRepositoryToken) | ||
private readonly testCategoryRepository: ITestCategoryRepository, | ||
) {} | ||
|
||
handle(input: TestCategoryUpdateUseCaseInput) { | ||
const { id, ...data } = input | ||
return this.testCategoryRepository.updateById(id, data) | ||
} | ||
} |
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
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/levansy-access-service/src/infrastructure/mongo/test-category/index.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,2 @@ | ||
export * from './repository' | ||
export * from './schema' |
Oops, something went wrong.