feat: implement organization insights dashboard with detailed metrics and collaboration data in sysadmin-cli
This commit is contained in:
@@ -3,6 +3,8 @@ import {
|
||||
SysAdminPaginateCompaniesParams,
|
||||
SysAdminUpdateCompanyParams,
|
||||
SysAdminSetCompanyBannedParams,
|
||||
SysAdminCompanyInsightsParams,
|
||||
SysAdminCompanyInsightsResult,
|
||||
} from "../../../Models/Companies/Companies.Interface";
|
||||
import { ApiValidationError } from "../../../Models/Server.Error.model";
|
||||
import { ApiVoidResult } from "../../../Models/Api.VoidResult.type";
|
||||
@@ -66,4 +68,23 @@ export class SysAdminCompaniesController extends Controller {
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
|
||||
@Response<ApiValidationError>(500, "Ha ocurrido un error")
|
||||
@SuccessResponse(200, "Done")
|
||||
@Post("insights")
|
||||
@Middlewares(sysAdminAuthMiddleware)
|
||||
public async sysAdminGetInsights(
|
||||
@Body() requestBody: SysAdminCompanyInsightsParams,
|
||||
): Promise<SysAdminCompanyInsightsResult | ApiValidationError> {
|
||||
try {
|
||||
const { payload, ...cleanRequestBody } = requestBody as any;
|
||||
const result = await new SA_CompaniesService().sysAdminGetInsights(cleanRequestBody);
|
||||
this.setStatus(200);
|
||||
return result;
|
||||
} catch (e) {
|
||||
const errorOccurred: Error = e as Error;
|
||||
this.setStatus(500);
|
||||
return new ApiValidationError(500, errorOccurred.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user