1
- import { FeatureNotFound } from '../../../src/organizational-entities /domain/errors .js' ;
1
+ import { ORGANIZATION_FEATURE } from '../../../src/shared /domain/constants .js' ;
2
2
import { Organization } from '../../../src/shared/domain/models/index.js' ;
3
3
4
4
const createOrganization = async function ( {
@@ -8,14 +8,14 @@ const createOrganization = async function ({
8
8
organizationCreationValidator,
9
9
schoolRepository,
10
10
codeGenerator,
11
- featureRepository,
12
- organizationFeatureRepository,
13
11
} ) {
14
12
organizationCreationValidator . validate ( organization ) ;
13
+ organization . features [ ORGANIZATION_FEATURE . MULTIPLE_SENDING_ASSESSMENT . key ] = {
14
+ active : true ,
15
+ params : null ,
16
+ } ;
15
17
const savedOrganization = await organizationForAdminRepository . save ( organization ) ;
16
18
17
- await addMultipleSendingsFeatureByDefault ( { featureRepository, organizationFeatureRepository } ) ;
18
-
19
19
await dataProtectionOfficerRepository . create ( {
20
20
organizationId : savedOrganization . id ,
21
21
firstName : organization . dataProtectionOfficer . firstName ,
@@ -30,19 +30,4 @@ const createOrganization = async function ({
30
30
return await organizationForAdminRepository . get ( savedOrganization . id ) ;
31
31
} ;
32
32
33
- const addMultipleSendingsFeatureByDefault = async function ( {
34
- featureRepository,
35
- organizationFeatureRepository,
36
- savedOrganization,
37
- } ) {
38
- const featureId = await featureRepository . getIdByKey ( 'MULTIPLE_SENDING_ASSESSMENT' ) . id ;
39
- if ( featureId ) {
40
- await organizationFeatureRepository . saveInBatch ( [
41
- { featureId, organizationId : savedOrganization . id , params : null } ,
42
- ] ) ;
43
- } else {
44
- throw new FeatureNotFound ( ) ;
45
- }
46
- } ;
47
-
48
33
export { createOrganization } ;
0 commit comments