feat: Add the workspace logo on Twenty logo on the invited route (#1136)
* Add the workspace logo on Twenty logo on the invited route Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Mael FOSSO <fosso.mael.elvis@gmail.com> * Add minor refactors Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Mael FOSSO <fosso.mael.elvis@gmail.com> * Refactor the invite logic Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Mael FOSSO <fosso.mael.elvis@gmail.com> --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Mael FOSSO <fosso.mael.elvis@gmail.com>
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
|
||||
import { WorkspaceService } from 'src/core/workspace/services/workspace.service';
|
||||
|
||||
import { AuthResolver } from './auth.resolver';
|
||||
|
||||
import { TokenService } from './services/token.service';
|
||||
@ -12,6 +14,10 @@ describe('AuthResolver', () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [
|
||||
AuthResolver,
|
||||
{
|
||||
provide: WorkspaceService,
|
||||
useValue: {},
|
||||
},
|
||||
{
|
||||
provide: AuthService,
|
||||
useValue: {},
|
||||
|
||||
@ -15,6 +15,8 @@ import { JwtAuthGuard } from 'src/guards/jwt.auth.guard';
|
||||
import { AuthUser } from 'src/decorators/auth-user.decorator';
|
||||
import { assert } from 'src/utils/assert';
|
||||
import { User } from 'src/core/@generated/user/user.model';
|
||||
import { Workspace } from 'src/core/@generated/workspace/workspace.model';
|
||||
import { WorkspaceService } from 'src/core/workspace/services/workspace.service';
|
||||
|
||||
import { AuthTokens } from './dto/token.entity';
|
||||
import { TokenService } from './services/token.service';
|
||||
@ -34,6 +36,7 @@ import { ImpersonateInput } from './dto/impersonate.input';
|
||||
@Resolver()
|
||||
export class AuthResolver {
|
||||
constructor(
|
||||
private workspaceService: WorkspaceService,
|
||||
private authService: AuthService,
|
||||
private tokenService: TokenService,
|
||||
) {}
|
||||
@ -57,6 +60,17 @@ export class AuthResolver {
|
||||
);
|
||||
}
|
||||
|
||||
@Query(() => Workspace)
|
||||
async findWorkspaceFromInviteHash(
|
||||
@Args() workspaceInviteHashValidInput: WorkspaceInviteHashValidInput,
|
||||
) {
|
||||
return await this.workspaceService.findFirst({
|
||||
where: {
|
||||
inviteHash: workspaceInviteHashValidInput.inviteHash,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@Mutation(() => LoginToken)
|
||||
async challenge(@Args() challengeInput: ChallengeInput): Promise<LoginToken> {
|
||||
const user = await this.authService.challenge(challengeInput);
|
||||
|
||||
Reference in New Issue
Block a user