-
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
42 changed files
with
245 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('indexing collections...') |
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,2 @@ | ||
export const AUTH_SUBJECT_ALL = 'all' | ||
export const AUTH_ACTION_ALL = 'manage' |
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 './action' | ||
export * from './subject' | ||
export * from './utils' | ||
export * from './constants' |
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
6 changes: 5 additions & 1 deletion
6
apps/hcdc-access-service/src/domain/entity/bio-product/entity.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,10 @@ | ||
import { BaseEntity } from '../base-entity' | ||
import { Branch } from '../branch' | ||
|
||
export type BioProduct = BaseEntity & { | ||
index: number | ||
displayIndex: number | ||
name: string | ||
|
||
branchId: string | ||
branch?: Branch | null | ||
} |
8 changes: 7 additions & 1 deletion
8
apps/hcdc-access-service/src/domain/entity/bio-product/example.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,11 +1,17 @@ | ||
import { exampleMongoObjectId } from '@diut/nest-core' | ||
|
||
import { EntityDataExample } from '../base-entity' | ||
import { BioProduct } from './entity' | ||
|
||
export const exampleBioProduct = { | ||
index: { | ||
displayIndex: { | ||
example: 1, | ||
}, | ||
name: { | ||
example: 'CHIV Advia centaur', | ||
}, | ||
branchId: exampleMongoObjectId, | ||
branch: { | ||
required: false, | ||
}, | ||
} satisfies EntityDataExample<BioProduct> |
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
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
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
19 changes: 19 additions & 0 deletions
19
apps/hcdc-access-service/src/domain/use-case/bio-product/validate.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 { Injectable } from '@nestjs/common' | ||
|
||
import { BioProduct, EntityData } from 'src/domain/entity' | ||
import { BranchAssertExistsUseCase } from '../branch/assert-exists' | ||
|
||
@Injectable() | ||
export class BioProductValidateUseCase { | ||
constructor( | ||
private readonly branchAssertExistsUseCase: BranchAssertExistsUseCase, | ||
) {} | ||
|
||
async execute(input: Partial<Pick<EntityData<BioProduct>, 'branchId'>>) { | ||
const { branchId } = input | ||
|
||
if (branchId !== undefined) { | ||
await this.branchAssertExistsUseCase.execute({ _id: branchId }) | ||
} | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
apps/hcdc-access-service/src/domain/use-case/branch/validate.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 { Injectable } from '@nestjs/common' | ||
|
||
import { Branch, EntityData } from 'src/domain/entity' | ||
import { BranchAssertExistsUseCase } from './assert-exists' | ||
|
||
@Injectable() | ||
export class BranchValidateUseCase { | ||
constructor( | ||
private readonly branchAssertExistsUseCase: BranchAssertExistsUseCase, | ||
) {} | ||
|
||
async execute(input: Partial<Pick<EntityData<Branch>, 'sampleOriginIds'>>) { | ||
const { sampleOriginIds } = input | ||
|
||
if (sampleOriginIds) { | ||
for (const branchId of sampleOriginIds) { | ||
await this.branchAssertExistsUseCase.execute({ _id: branchId }) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.