mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-27 18:19:48 +00:00
fix: validate request org id existance in guards
This commit is contained in:
@@ -18,7 +18,7 @@ export class EnsureTenantIsInitializedGuard implements CanActivate {
|
||||
constructor(
|
||||
private readonly tenancyContext: TenancyContext,
|
||||
private reflector: Reflector,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
/**
|
||||
* Validate the tenant of the current request is initialized..
|
||||
@@ -41,6 +41,12 @@ export class EnsureTenantIsInitializedGuard implements CanActivate {
|
||||
}
|
||||
const tenant = await this.tenancyContext.getTenant();
|
||||
|
||||
if (!tenant) {
|
||||
throw new UnauthorizedException({
|
||||
message: 'Tenant not found.',
|
||||
errors: [{ type: 'TENANT.NOT.FOUND' }],
|
||||
});
|
||||
}
|
||||
if (!tenant?.initializedAt) {
|
||||
throw new UnauthorizedException({
|
||||
statusCode: 400,
|
||||
|
||||
Reference in New Issue
Block a user