-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create model and repositories to preAssign decision * add preAssignation service tests * create pre assignation api endpoints * fix import in controller * create assignation when there is a preAssignation after nlp annotation * add delete preassignation route on api * first step for frontend * create delete oprtion * get userName instead of userId * refetch on delete * add pre-assignation creation button * add pre assignation creation * lint * adapt clear db * fix tests * fix to run script without docker * change behavior to accept appealNumbers * fix docker start * reset path to storage * fix paths to execute scripts * changes from review --------- Co-authored-by: Antoine Jeanneney <antoine.jeanneney@justice.fr>
- Loading branch information
1 parent
ef1b5c3
commit 8e39746
Showing
40 changed files
with
984 additions
and
75 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 |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
- statistics | ||
- treatments | ||
- users | ||
- preAssignations |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { buildPreAssignationRepository } from './repository'; | ||
import { preAssignationService } from './service'; | ||
|
||
export { buildPreAssignationRepository, preAssignationService }; |
20 changes: 20 additions & 0 deletions
20
...eneric/backend/src/modules/preAssignation/repository/buildFakePreAssignationRepository.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,20 @@ | ||
import { preAssignationType } from '@label/core'; | ||
import { buildFakeRepositoryBuilder } from '../../../repository'; | ||
import { customPreAssignationRepositoryType } from './customPreAssignationRepositoryType'; | ||
|
||
export { buildFakePreAssignationRepository }; | ||
|
||
const buildFakePreAssignationRepository = buildFakeRepositoryBuilder< | ||
preAssignationType, | ||
customPreAssignationRepositoryType | ||
>({ | ||
collectionName: 'preAssignations', | ||
buildCustomFakeRepository: (collection) => ({ | ||
async findOneByNumberAndSource({ number, source }) { | ||
return collection.find( | ||
(preAssignation) => | ||
preAssignation.source === source && preAssignation.number === number, | ||
); | ||
}, | ||
}), | ||
}); |
27 changes: 27 additions & 0 deletions
27
...es/generic/backend/src/modules/preAssignation/repository/buildPreAssignationRepository.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,27 @@ | ||
import { preAssignationType } from '@label/core'; | ||
import { buildRepositoryBuilder } from '../../../repository'; | ||
import { customPreAssignationRepositoryType } from './customPreAssignationRepositoryType'; | ||
|
||
export { buildPreAssignationRepository }; | ||
|
||
const buildPreAssignationRepository = buildRepositoryBuilder< | ||
preAssignationType, | ||
customPreAssignationRepositoryType | ||
>({ | ||
collectionName: 'preAssignations', | ||
indexes: [ | ||
{ | ||
index: { source: 1, number: 1 }, | ||
mustBeUnique: true, | ||
} as const, | ||
], | ||
buildCustomRepository: (collection) => ({ | ||
async findOneByNumberAndSource({ number, source }) { | ||
const preAssignation = await collection.findOne({ | ||
number, | ||
source, | ||
}); | ||
return preAssignation || undefined; | ||
}, | ||
}), | ||
}); |
13 changes: 13 additions & 0 deletions
13
...neric/backend/src/modules/preAssignation/repository/customPreAssignationRepositoryType.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,13 @@ | ||
import { preAssignationType } from '@label/core'; | ||
|
||
export type { customPreAssignationRepositoryType }; | ||
|
||
type customPreAssignationRepositoryType = { | ||
findOneByNumberAndSource: ({ | ||
number, | ||
source, | ||
}: { | ||
number: string; | ||
source: string; | ||
}) => Promise<preAssignationType | undefined>; | ||
}; |
11 changes: 11 additions & 0 deletions
11
packages/generic/backend/src/modules/preAssignation/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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { dependencyManager } from '../../../utils'; | ||
import { buildPreAssignationRepository } from './buildPreAssignationRepository'; | ||
import { buildFakePreAssignationRepository } from './buildFakePreAssignationRepository'; | ||
|
||
export { buildRepository as buildPreAssignationRepository }; | ||
|
||
const buildRepository = dependencyManager.inject({ | ||
forLocal: buildPreAssignationRepository, | ||
forProd: buildPreAssignationRepository, | ||
forTest: buildFakePreAssignationRepository, | ||
}); |
27 changes: 27 additions & 0 deletions
27
packages/generic/backend/src/modules/preAssignation/service/createPreAssignation.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,27 @@ | ||
import { preAssignationModule, idType } from '@label/core'; | ||
import { buildPreAssignationRepository } from '..'; | ||
|
||
export { createPreAssignation }; | ||
|
||
async function createPreAssignation({ | ||
userId, | ||
source, | ||
number, | ||
}: { | ||
userId: idType; | ||
source: string; | ||
number: string; | ||
}) { | ||
const preAssignationRepository = buildPreAssignationRepository(); | ||
|
||
const preAssignation = preAssignationModule.lib.buildPreAssignation({ | ||
userId, | ||
source, | ||
number, | ||
creationDate: new Date().getTime(), | ||
}); | ||
|
||
await preAssignationRepository.insert(preAssignation); | ||
|
||
return preAssignation; | ||
} |
Oops, something went wrong.