Renamed user/tag-create-req.json to imported-user/tag-create-req.json
RENAME
src/assets/server/rest/v1/schemas/tag/tag-create-req.json
src/assets/server/rest/v1/schemas/tag/imported-tag-create-req.json
RENAME
src/assets/server/rest/v1/schemas/user/user-create-req.json
src/assets/server/rest/v1/schemas/user/imported-user-create-req.json
MODIFY
src/server/rest/v1/service/TagService.ts
src/server/rest/v1/service/TagService.ts
@@ -678,7 +678,7 @@ export default class TagService {
description: importedTag.description ? importedTag.description : `Badge ID '${importedTag.id}'`,
};
// Validate Tad data
- TagValidator.getInstance().validateTagCreation(newImportedTag);
+ TagValidator.getInstance().validateImportedTagCreation(newImportedTag);
// Save it for import
await TagStorage.saveImportedTag(req.user.tenantID, newImportedTag);
return true;

MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -1281,7 +1281,7 @@ export default class UserService {
firstName: user.FirstName,
email: user.Email,
};
- UserValidator.getInstance().validateUserCreation(newUploadedUser);
+ UserValidator.getInstance().validateImportedUserCreation(newUploadedUser);
newUploadedUser.importedBy = req.user.id;
await UserStorage.saveImportedUser(req.user.tenantID, newUploadedUser);
} catch (error) {

MODIFY
src/server/rest/v1/validator/TagValidation.ts
src/server/rest/v1/validator/TagValidation.ts
@@ -6,11 +6,11 @@ import global from '../../../../types/GlobalType';
export default class TagValidator extends SchemaValidator {
private static instance: TagValidator|null = null;
- private tagCreation: Schema;
+ private importedTagCreation: Schema;
private constructor() {
super('TagValidator');
- this.tagCreation = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/tag/tag-create-req.json`, 'utf8'));
+ this.importedTagCreation = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/tag/imported-tag-create-req.json`, 'utf8'));
}
public static getInstance(): TagValidator {
@@ -20,7 +20,7 @@ export default class TagValidator extends SchemaValidator {
return TagValidator.instance;
}
- validateTagCreation(importedTag: ImportedTag): void {
- this.validate(this.tagCreation, importedTag);
+ validateImportedTagCreation(importedTag: ImportedTag): void {
+ this.validate(this.importedTagCreation, importedTag);
}
}

MODIFY
src/server/rest/v1/validator/UserValidation.ts
src/server/rest/v1/validator/UserValidation.ts
@@ -6,11 +6,11 @@ import global from '../../../../types/GlobalType';
export default class UserValidator extends SchemaValidator {
private static instance: UserValidator|null = null;
- private userCreation: Schema;
+ private importedUserCreation: Schema;
private constructor() {
super('UserValidator');
- this.userCreation = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/user/user-create-req.json`, 'utf8'));
+ this.importedUserCreation = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/user/imported-user-create-req.json`, 'utf8'));
}
public static getInstance(): UserValidator {
@@ -20,7 +20,7 @@ export default class UserValidator extends SchemaValidator {
return UserValidator.instance;
}
- validateUserCreation(importedUser: ImportedUser): void {
- this.validate(this.userCreation, importedUser);
+ validateImportedUserCreation(importedUser: ImportedUser): void {
+ this.validate(this.importedUserCreation, importedUser);
}
}

Renamed user/tag-create-req.json to imported-user/tag-create-req.json