Skip to content

Commit 9dfa320

Browse files
tacxoualainabbas
andauthored
Settings new (#33)
* save * chore: Update app.module.ts imports formatting * save * save * chore: Refactor swagger.ts for improved readability and maintainability * save * save * save * save * save * save * save * save * save * parametres TTL * Update identities.dto.stub.ts * correction de bug * Fix bug in code * Squashed commit of the following: commit 0cb4493 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Aug 12 15:20:14 2024 +0200 chore: Update filestorage configuration for identities module commit 6e2fccb Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Fri Aug 9 17:31:36 2024 +0200 chore: Add @public() decorator to readPhotoRaw endpoint in IdentitiesController commit f73fe12 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Wed Aug 7 16:13:22 2024 +0200 chore: Update filestorage configuration for identities module commit 0fd136a Author: Github Action <github@action.com> Date: Fri Aug 2 13:36:33 2024 +0000 v0.2.3 commit 8ae4cdd Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Fri Aug 2 15:35:35 2024 +0200 Update inetOrgPerson.part.ts schema properties commit 142523c Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Fri Aug 2 15:35:03 2024 +0200 chore: Update inetOrgPerson.part.ts schema properties commit 961d364 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Aug 1 18:03:45 2024 +0200 Refactor FilestorageService to remove unnecessary console.log statements commit cedce4e Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Aug 1 13:01:15 2024 +0200 chore: Refactor FilestorageController to use core/filestorage tag commit ded8f05 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Aug 1 13:00:49 2024 +0200 feat: Add conditional check for updating file path in FilestorageService commit 79ade1f Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Aug 1 10:52:24 2024 +0200 feat: Add conditional check for updating file path in FilestorageService commit 4c638f5 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Aug 1 10:16:32 2024 +0200 chore: Add FilestorageModule to CoreModule imports commit 84c012f Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Aug 1 10:16:22 2024 +0200 chore: Add @the-software-compagny/nestjs_module_factorydrive and @the-software-compagny/nestjs_module_factorydrive-s3 dependencies commit e7a3ec2 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Aug 1 08:27:23 2024 +0200 chore: Remove unused MjmlAdapter import in app.module.ts commit d0ffddc Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Wed Jul 31 17:21:42 2024 +0200 chore: Update Makefile to enable debugging during development commit de09f99 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Aug 1 08:24:20 2024 +0200 chore: Refactor swagger.ts for improved readability and maintainability commit 49e1ae0 Author: Alain Abbas <alain.abbas@libertech.fr> Date: Wed Jul 31 18:12:57 2024 +0200 save commit 9d45bed Author: Alain Abbas <alain.abbas@libertech.fr> Date: Wed Jul 31 17:41:34 2024 +0200 save commit 85a4ce7 Author: Alain Abbas <alain.abbas@libertech.fr> Date: Wed Jul 31 17:21:41 2024 +0200 save commit b5bd3a8 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Wed Jul 31 17:21:42 2024 +0200 chore: Update Makefile to enable debugging during development commit cb5b89f Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Wed Jul 31 16:28:32 2024 +0200 chore: Update import statement for FilterOptions in identities.controller.spec.ts --------- Co-authored-by: Alain Abbas <alain.abbas@libertech.fr>
1 parent 0cb4493 commit 9dfa320

24 files changed

+480
-116
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SESAME_LOG_LEVEL="info"
22
# SESAME_NAME_QUEUE="sesame"
33
SESAME_JWT_SECRET="zeaezazeaezazaeeazrftrqezfqfqszewfsqddfqsqsqsdqdsqdsqdzsdqzsdqzs"
4-
54
SESAME_REDIS_URI="redis://sesame-redis:6379"
65
SESAME_MONGO_URI="mongodb://sesame-mongodb:27017/sesame"
6+
# Adresse du frontal de changement de mot de passe
7+
SESAME_FRONT_MDP="http://localhost:3000"

src/app.module.ts

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ import { APP_FILTER, APP_GUARD, APP_PIPE } from '@nestjs/core';
1515
import { AuthGuard } from './_common/guards/auth.guard';
1616
import { MongooseValidationFilter } from './_common/filters/mongoose-validation.filter';
1717
import { DtoValidationPipe } from './_common/pipes/dto-validation.pipe';
18-
import { SettingstModule } from '~/settings/settings.module';
18+
import { SettingsModule } from '~/settings/settings.module';
1919
import { MailerModule } from '@nestjs-modules/mailer';
2020
import { HandlebarsAdapter } from '@nestjs-modules/mailer/dist/adapters/handlebars.adapter';
21+
import { MjmlAdapter } from '@nestjs-modules/mailer/dist/adapters/mjml.adapter';
22+
import { MailadmService } from '~/settings/mailadm.service';
23+
import { SettingsService } from '~/settings/settings.service';
2124
import { FactorydriveModule } from '@the-software-compagny/nestjs_module_factorydrive';
2225

2326
@Module({
@@ -27,21 +30,24 @@ import { FactorydriveModule } from '@the-software-compagny/nestjs_module_factory
2730
load: [config],
2831
}),
2932
MailerModule.forRootAsync({
30-
imports: [ConfigModule],
31-
inject: [ConfigService],
32-
useFactory: async (config: ConfigService) => ({
33-
transport: config.get('mailer.host') || 'smtp://localhost:25',
34-
defaults: {
35-
from: config.get('mailer.sender'),
36-
},
37-
template: {
38-
dir: __dirname + '/../templates',
39-
adapter: new HandlebarsAdapter(),
40-
options: {
41-
strict: true,
33+
imports: [SettingsModule],
34+
inject: [MailadmService],
35+
useFactory: async (service: MailadmService) => {
36+
const params = await service.getParams();
37+
return {
38+
transport: params.host,
39+
defaults: {
40+
from: params.sender,
4241
},
43-
},
44-
}),
42+
template: {
43+
dir: __dirname + '/../templates',
44+
adapter: new HandlebarsAdapter(),
45+
options: {
46+
strict: true,
47+
},
48+
},
49+
};
50+
},
4551
}),
4652
MongooseModule.forRootAsync({
4753
imports: [ConfigModule],
@@ -87,7 +93,7 @@ import { FactorydriveModule } from '@the-software-compagny/nestjs_module_factory
8793
RequestContextModule,
8894
CoreModule.register(),
8995
ManagementModule.register(),
90-
SettingstModule.register(),
96+
SettingsModule.register(),
9197
],
9298
controllers: [AppController],
9399
providers: [
@@ -110,4 +116,4 @@ import { FactorydriveModule } from '@the-software-compagny/nestjs_module_factory
110116
},
111117
],
112118
})
113-
export class AppModule {}
119+
export class AppModule { }

src/management/identities/_dto/identities.dto.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@ import { IdentityLifecycle } from '../_enums/lifecycle.enum';
66
import { Type } from 'class-transformer';
77
import { additionalFieldsPartDto } from './_parts/additionalFields.dto';
88
import { MetadataDto } from '~/_common/abstracts/dto/metadata.dto';
9+
import { InitStatesEnum } from '~/management/identities/_enums/init-state.enum';
910

1011
export class IdentitiesCreateDto extends MetadataDto {
1112
@IsNumber()
1213
@IsEnum(IdentityState)
1314
@ApiProperty({ enum: IdentityState })
1415
state: IdentityState;
1516

17+
@IsNumber()
18+
@IsEnum(InitStatesEnum)
19+
@ApiProperty({ enum: InitStatesEnum })
20+
initState: InitStatesEnum;
21+
1622
@IsNumber()
1723
@IsOptional()
1824
@IsEnum(IdentityLifecycle)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export enum InitStatesEnum {
2+
NOSENT = 0,
3+
SENT = 1,
4+
INITIALIZED = 2,
5+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2+
import { Document } from 'mongoose';
3+
import { Identities } from '~/management/identities/_schemas/identities.schema';
4+
5+
@Schema({ _id: false })
6+
export class InitInfoPart extends Document {
7+
@Prop({ type: Date })
8+
sentDate?: Date;
9+
@Prop({ type: Date })
10+
initDate?: Date;
11+
}
12+
export const InitInfoPartSchema = SchemaFactory.createForClass(InitInfoPart);

src/management/identities/_schemas/identities.schema.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Document } from 'mongoose';
55
import { AbstractSchema } from '~/_common/abstracts/schemas/abstract.schema';
66
import { IdentityState } from '../_enums/states.enum';
77
import { AdditionalFieldsPart, AdditionalFieldsPartSchema } from './_parts/additionalFields.part.schema';
8+
import { InitStatesEnum } from '~/management/identities/_enums/init-state.enum';
9+
import { InitInfoPart, InitInfoPartSchema } from '~/management/identities/_schemas/_parts/init-info.part.schema';
810

911
export type IdentitiesDocument = Identities & Document;
1012

@@ -27,6 +29,12 @@ export class Identities extends AbstractSchema {
2729

2830
@Prop({ type: Date })
2931
lastSync?: Date;
32+
33+
@Prop({ type: Number, enum: InitStatesEnum, default: InitStatesEnum.NOSENT })
34+
initState: InitStatesEnum;
35+
36+
@Prop({ type: InitInfoPartSchema, default: {} })
37+
initInfo: InitInfoPart;
3038
}
3139

3240
export const IdentitiesSchema = SchemaFactory.createForClass(Identities);

src/management/identities/_stubs/identities.dto.stub.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import { IdentityLifecycle } from '~/management/identities/_enums/lifecycle.enum
44
import { IdentityState } from '~/management/identities/_enums/states.enum';
55
import { additionalFieldsPartDtoStub } from './_parts/addtionalFields.dto.stub';
66
import { inetOrgPersonDtoStub } from './_parts/inetOrgPerson.dto.stub';
7+
import { InitStatesEnum } from '~/management/identities/_enums/init-state.enum';
78

89
export const IdentitiesDtoStub = (): IdentitiesDto => {
910
return {
1011
state: IdentityState.TO_CREATE,
1112
lifecycle: IdentityLifecycle.INACTIVE,
1213
inetOrgPerson: inetOrgPersonDtoStub(),
1314
additionalFields: additionalFieldsPartDtoStub(),
15+
initState: InitStatesEnum.NOSENT,
1416
};
1517
};
1618

@@ -20,6 +22,7 @@ export const IdentitiesUpdateDtoStub = (): IdentitiesUpdateDto => {
2022
return {
2123
state: IdentityState.TO_COMPLETE,
2224
lifecycle: IdentityLifecycle.INACTIVE,
25+
initState: InitStatesEnum.NOSENT,
2326
inetOrgPerson,
2427
additionalFields: additionalFieldsPartDtoStub(),
2528
};

src/management/identities/identities.controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export class IdentitiesController extends AbstractController {
6363
}
6464
protected static readonly projection: PartialProjectionType<IdentitiesDto> = {
6565
state: 1,
66+
initState: 1,
6667
inetOrgPerson: 1,
6768
additionalFields: 1,
6869
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Types } from 'mongoose';
2+
import { ApiProperty } from '@nestjs/swagger';
3+
import { IsArray } from 'class-validator';
4+
5+
export class InitManyDto {
6+
@ApiProperty({ description: 'Envoie la demande d init à plusieurs identitées. Id des identities' })
7+
@IsArray()
8+
public ids: Types.ObjectId[];
9+
}
File renamed without changes.

0 commit comments

Comments
 (0)