Add workspacePreQueryHook module (#3879)

* rebase

* reorganise messaging folders

* fix

* fix after review

* fix yarn lock
This commit is contained in:
Weiko
2024-02-13 18:23:29 +01:00
committed by GitHub
parent 36b69a8625
commit 458e8c839f
63 changed files with 494 additions and 70 deletions

View File

@ -34,11 +34,11 @@ import {
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { User } from 'src/core/user/user.entity';
import { RefreshToken } from 'src/core/refresh-token/refresh-token.entity';
import { Workspace } from 'src/core/workspace/workspace.entity';
import { ValidatePasswordResetToken } from 'src/core/auth/dto/validate-password-reset-token.entity';
import { EmailService } from 'src/integrations/email/email.service';
import { InvalidatePassword } from 'src/core/auth/dto/invalidate-password.entity';
import { EmailPasswordResetLink } from 'src/core/auth/dto/email-password-reset-link.entity';
import { JwtData } from 'src/core/auth/types/jwt-data.type';
@Injectable()
export class TokenService {
@ -192,10 +192,7 @@ export class TokenService {
return !!token;
}
async validateToken(request: Request): Promise<{
user?: User;
workspace: Workspace;
}> {
async validateToken(request: Request): Promise<JwtData> {
const token = ExtractJwt.fromAuthHeaderAsBearerToken()(request);
if (!token) {

View File

@ -0,0 +1,7 @@
import { User } from 'src/core/user/user.entity';
import { Workspace } from 'src/core/workspace/workspace.entity';
export type JwtData = {
user?: User | undefined;
workspace: Workspace;
};