feat: removed unnecessary checks

This commit is contained in:
mirarifhasan
2024-02-08 15:30:05 +06:00
committed by Andrew Bastin
parent 01fd27f81a
commit b0b7df0a3e

View File

@@ -51,17 +51,9 @@ export class InfraConfigService implements OnModuleInit {
*/
async initializeInfraConfigTable() {
try {
// Get all the 'names' of the properties from ENUM to be saved in the 'infra_config' table
const enumValues = Object.values(InfraConfigEnum);
// Fetch the default values (value in .env) for configs to be saved in 'infra_config' table
const infraConfigDefaultObjs = await getDefaultInfraConfigs();
// Cross-check if all the 'names' are listed in the default-values-list and ENUM at the same time
if (enumValues.length !== infraConfigDefaultObjs.length) {
throw new Error(INFRA_CONFIG_NOT_LISTED);
}
// Eliminate the rows (from 'infraConfigDefaultObjs') that are already present in the database table
const dbInfraConfigs = await this.prisma.infraConfig.findMany();
const propsToInsert = infraConfigDefaultObjs.filter(