modified for fee api

This commit is contained in:
Kallesh B S 2025-05-20 15:14:33 +05:30
parent 06ccbec937
commit fa18c1ab7b
3 changed files with 49 additions and 45 deletions

View File

@ -30,9 +30,9 @@ export class ManageFeeService {
}
return result.recordset;
}
throw new InternalServerException();
throw new BadRequestException();
} catch (error) {
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -52,9 +52,9 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 201, message: "Created Successfully" };
return { statusCode: 201, message: "Created Successfully", ...result.recordset[0] };
} catch (error) {
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -72,9 +72,9 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 200, message: "Updated Successfully" };
return { statusCode: 200, message: "Updated Successfully", ...result.recordset[0] };
} catch (error) {
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -96,11 +96,11 @@ export class ManageFeeService {
}
return result.recordset;
}
throw new InternalServerException();
throw new BadRequestException();
} catch (error) {
console.log(error);
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -124,10 +124,10 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 201, message: "Created Successfully" };
return { statusCode: 201, message: "Created Successfully", ...result.recordset[0] };
} catch (error) {
console.log(error);
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -147,9 +147,9 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 200, message: "Updated Successfully" };
return { statusCode: 200, message: "Updated Successfully", ...result.recordset[0] };
} catch (error) {
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -176,7 +176,7 @@ export class ManageFeeService {
if (error instanceof BadRequestException) {
throw error
}
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -197,10 +197,10 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 201, message: "Created Successfully" };
return { statusCode: 201, message: "Created Successfully", ...result.recordset[0] };
} catch (error) {
console.log(error);
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -218,10 +218,10 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 200, message: "Updated Successfully" };
return { statusCode: 200, message: "Updated Successfully", ...result.recordset[0] };
} catch (error) {
console.log(error);
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -248,7 +248,7 @@ export class ManageFeeService {
if (error instanceof BadRequestException) {
throw error
}
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -271,10 +271,10 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 201, message: "Created Successfully" };
return { statusCode: 201, message: "Created Successfully", ...result.recordset[0] };
} catch (error) {
console.log(error);
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -294,10 +294,10 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 200, message: "Updated Successfully" };
return { statusCode: 200, message: "Updated Successfully", ...result.recordset[0] };
} catch (error) {
console.log(error);
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -323,7 +323,7 @@ export class ManageFeeService {
if (error instanceof BadRequestException) {
throw error
}
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -344,10 +344,10 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 201, message: "Created Successfully" };
return { statusCode: 201, message: "Created Successfully", ...result.recordset[0] };
} catch (error) {
console.log(error);
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -366,10 +366,10 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 200, message: "Updated Successfully" };
return { statusCode: 200, message: "Updated Successfully", ...result.recordset[0] };
} catch (error) {
console.log(error);
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -396,7 +396,7 @@ export class ManageFeeService {
if (error instanceof BadRequestException) {
throw error
}
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -419,10 +419,10 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 201, message: "Created Successfully" };
return { statusCode: 201, message: "Created Successfully", ...result.recordset[0] };
} catch (error) {
console.log(error);
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -441,10 +441,10 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 200, message: "Updated Successfully" };
return { statusCode: 200, message: "Updated Successfully", ...result.recordset[0] };
} catch (error) {
console.log(error);
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -473,7 +473,7 @@ export class ManageFeeService {
if (error instanceof BadRequestException) {
throw error
}
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -489,14 +489,16 @@ export class ManageFeeService {
request.input('P_EFFDATE', mssql.VarChar(100), body.P_EFFDATE);
request.input('P_USERID', mssql.VarChar(100), body.P_USERID);
const result = await request.execute('carnetsys.CreateFeeComm');
console.log(result);
if (result.recordset && result.recordset.length > 0 && result.recordset[0].ERRORMESG) {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 201, message: "Created Successfully" };
return { statusCode: 201, message: "Created Successfully", ...result.recordset[0] };
} catch (error) {
console.log(error);
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -514,10 +516,10 @@ export class ManageFeeService {
this.logger.warn(`error from DB: ${result.recordset[0].ERRORMESG}`);
throw new BadRequestException(result.recordset[0].ERRORMESG);
}
return { statusCode: 200, message: "Updated Successfully" };
return { statusCode: 200, message: "Updated Successfully", ...result.recordset[0] };
} catch (error) {
console.log(error);
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
}

View File

@ -35,7 +35,7 @@ export class ParamTableService {
const result = await request.execute('carnetsys.GETPARAMVALUES');
return result.recordset;
} catch (error) {
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -56,7 +56,9 @@ export class ParamTableService {
return { statusCode: 201, message: "Created Successfully" }
}
} catch (error) {
throw new InternalServerException();
console.log(error);
throw new InternalServerException(error.message);
}
}
@ -114,7 +116,7 @@ export class ParamTableService {
return { statusCode: 200, message: "Updated Successfully" }
}
} catch (error) {
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -135,7 +137,7 @@ export class ParamTableService {
return { statusCode: 200, message: result['recordset'][0].message }
}
} catch (error) {
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
@ -155,7 +157,7 @@ export class ParamTableService {
return { statusCode: 200, message: result['recordset'][0].message }
}
} catch (error) {
throw new InternalServerException();
throw new InternalServerException(error.message);
}
}
}

View File

@ -16,7 +16,7 @@ export class RegionService {
connection = await this.mssqlDBService.getConnection();
const request = new Request(connection);
const result = await request.execute('carnetsys.GETREGIONS');
return { data: result.recordset };
return result.recordset;
} catch (error) {
throw new InternalServerException();
}
@ -31,7 +31,7 @@ export class RegionService {
request.input('P_REGION', mssql.VarChar(mssql.MAX), body.p_region);
request.input('P_NAME', mssql.VarChar(mssql.MAX), body.p_name);
const result = await request.execute('carnetsys.INSERTNEWREGION');
return { data: result.recordset };
return { statusCode: 201, message: "Created Successfully", ...result.recordset[0] };
} catch (error) {
throw new InternalServerException();
@ -46,7 +46,7 @@ export class RegionService {
request.input('p_regionID', mssql.Int, body.p_regionID);
request.input('P_NAME', mssql.VarChar(mssql.MAX), body.p_name);
const result = await request.execute('carnetsys.UpdateRegion');
return { data: result.recordset };
return { statusCode: 200, message: "Updated Successfully", ...result.recordset[0] };
} catch (error) {
throw new InternalServerException();