Skip to content

Commit f07fb9b

Browse files
committed
chore: Update identities validation service to include only YAML files in result
1 parent 4e1884a commit f07fb9b

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
type: Group
2+
label: Identité
3+
elements:
4+
- type: HorizontalLayout
5+
elements:
6+
- type: Control
7+
label: test1
8+
scope: "#/properties/test1"
9+
options:
10+
required: true
11+
- type: Control
12+
label: test2
13+
scope: "#/properties/test2"
14+
options:
15+
required: true

src/management/identities/validations/identities.validation.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class IdentitiesValidationController extends AbstractController {
4848
@Get()
4949
@ApiOperation({ summary: 'Liste les schémas personnalisés d\'identités' })
5050
async searchAll(@Res() res: Response): Promise<any> {
51-
const result = await this._service.findAll();
51+
const [result] = await this._service.findAll();
5252
return res.status(HttpStatus.OK).json({
5353
statusCode: HttpStatus.OK,
5454
data: result,

src/management/identities/validations/identities.validation.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,12 @@ export class IdentitiesValidationService {
156156

157157
const result = [];
158158
for (const fileObj of files) {
159+
if (/.yml$/.test(fileObj.file) === false) continue;
160+
159161
const filePath = `${fileObj.path}/${fileObj.file}`;
160162
const data = parse(readFileSync(filePath, 'utf-8'));
161163
const key = fileObj.file.replace('.yml', '');
162-
result.push({ [key]: data, source: fileObj.source });
164+
result.push({ [key]: data, source: fileObj.source, name: key });
163165
}
164166
return [result, files.length];
165167
}

0 commit comments

Comments
 (0)