fix: lint issues for unimplemented methods

This commit is contained in:
montaghanmy
2023-04-07 10:09:25 +01:00
parent 254df9828c
commit de0a2d2066
3 changed files with 13 additions and 4 deletions
@@ -37,16 +37,17 @@ export class ConsoleRemoteClient implements ConsoleServiceClient {
issuer: this.infos.issuer?.replace(/\/+$/, ""), issuer: this.infos.issuer?.replace(/\/+$/, ""),
jwksUri: this.infos.jwks_uri, jwksUri: this.infos.jwks_uri,
// For local deployment create a https agent that ignore self signed certificate // For local deployment create a https agent that ignore self signed certificate
// eslint-disable-next-line @typescript-eslint/no-var-requires
requestAgent: new (require("https").Agent)({ requestAgent: new (require("https").Agent)({
rejectUnauthorized: this.infos.issuer.includes("example.com") ? false : true, rejectUnauthorized: this.infos.issuer.includes("example.com") ? false : true,
}), }),
}); });
} }
fetchCompanyInfo(consoleCompanyCode: string): Promise<ConsoleHookCompany> { fetchCompanyInfo(consoleCompanyCode: string): Promise<ConsoleHookCompany> {
throw new Error("Method not implemented."); throw new Error(`Method not implemented, ${consoleCompanyCode}.`);
} }
resendVerificationEmail(email: string): Promise<void> { resendVerificationEmail(email: string): Promise<void> {
throw new Error("Method not implemented."); throw new Error(`Method not implemented, ${email}.`);
} }
private auth() { private auth() {
@@ -57,6 +58,7 @@ export class ConsoleRemoteClient implements ConsoleServiceClient {
company: ConsoleCompany, company: ConsoleCompany,
user: CreateConsoleUser, user: CreateConsoleUser,
): Promise<CreatedConsoleUser> { ): Promise<CreatedConsoleUser> {
logger.info(`Method not implemented, ${company.id}, ${user.id}.`);
return null; return null;
} }
@@ -65,22 +67,26 @@ export class ConsoleRemoteClient implements ConsoleServiceClient {
user: UpdateConsoleUserRole, user: UpdateConsoleUserRole,
): Promise<UpdatedConsoleUserRole> { ): Promise<UpdatedConsoleUserRole> {
logger.info("Remote: updateUserRole"); logger.info("Remote: updateUserRole");
logger.info(`Method not implemented, ${company.id}, ${user.id}.`);
return null; return null;
} }
async createCompany(company: CreateConsoleCompany): Promise<CreatedConsoleCompany> { async createCompany(company: CreateConsoleCompany): Promise<CreatedConsoleCompany> {
logger.info("Remote: createCompany"); logger.info("Remote: createCompany");
logger.info(`Method not implemented, ${company}.`);
return null; return null;
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
addUserToTwake(user: CreateConsoleUser): Promise<User> { addUserToTwake(user: CreateConsoleUser): Promise<User> {
logger.info("Remote: addUserToTwake"); logger.info("Remote: addUserToTwake");
logger.info(`Method not implemented, ${user}.`);
//should do noting for real console //should do noting for real console
return Promise.resolve(undefined); return Promise.resolve(undefined);
} }
async updateLocalCompanyFromConsole(partialCompanyDTO: ConsoleHookCompany): Promise<Company> { async updateLocalCompanyFromConsole(partialCompanyDTO: ConsoleHookCompany): Promise<Company> {
logger.info(`Method not implemented, ${partialCompanyDTO}.`);
return null; return null;
} }
@@ -95,6 +101,9 @@ export class ConsoleRemoteClient implements ConsoleServiceClient {
role => role.applications === undefined || role.applications.find(a => a.code === "twake"), role => role.applications === undefined || role.applications.find(a => a.code === "twake"),
); );
//REMOVE LATER
logger.info(`Roles are: ${roles}.`);
let user = await gr.services.users.getByConsoleId(userDTO.email); let user = await gr.services.users.getByConsoleId(userDTO.email);
if (!user) { if (!user) {
@@ -238,7 +238,7 @@ export class ConsoleController {
private async userUpdated(code: string) { private async userUpdated(code: string) {
//Not implemented yet //Not implemented yet
throw CrudException.notImplemented("Unimplemented"); throw CrudException.notImplemented(`Method not implemented, ${code}.`);
} }
private async companyRemoved(content: ConsoleHookCompanyDeletedContent) { private async companyRemoved(content: ConsoleHookCompanyDeletedContent) {
@@ -12,7 +12,7 @@ const routes: FastifyPluginCallback = (fastify: FastifyInstance, options, next)
const accessControl = async ( const accessControl = async (
request: FastifyRequest<{ Body: ConsoleHookBody; Querystring: ConsoleHookQueryString }>, request: FastifyRequest<{ Body: ConsoleHookBody; Querystring: ConsoleHookQueryString }>,
) => { ) => {
throw fastify.httpErrors.notImplemented("Hook service doesn't exist anymore"); throw fastify.httpErrors.notImplemented(`Hook service doesn't exist anymore, ${request}.`);
}; };
fastify.route({ fastify.route({