2026-09-09 09:19:41 +00:00
|
|
|
import { ExpressController, requireAuthenticatedGuard } from "@erp/core/api";
|
2026-09-08 21:41:23 +00:00
|
|
|
|
|
|
|
|
import type { GetInitialOnboardingStatusUseCase } from "../../application";
|
|
|
|
|
|
|
|
|
|
export class GetInitialOnboardingStatusController extends ExpressController {
|
|
|
|
|
constructor(private readonly useCase: GetInitialOnboardingStatusUseCase) {
|
|
|
|
|
super();
|
2026-09-09 09:19:41 +00:00
|
|
|
this.registerGuards(requireAuthenticatedGuard());
|
2026-09-08 21:41:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected async executeImpl() {
|
|
|
|
|
const user = this.getUser();
|
|
|
|
|
if (!user?.userId) {
|
|
|
|
|
return this.unauthorizedError("Unauthorized");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const result = await this.useCase.execute({ accountId: user.userId });
|
|
|
|
|
return result.match(
|
|
|
|
|
(value) => this.ok({ status: value.status, company_id: value.companyId }),
|
|
|
|
|
(error) => this.handleError(error)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|