Initial commit: Prism messenger with Expo + NestJS + GraphQL + PostgreSQL

This commit is contained in:
Bivekich
2025-08-06 02:19:37 +03:00
commit 6fb83334d6
56 changed files with 24295 additions and 0 deletions

View File

@ -0,0 +1,34 @@
import { Resolver, Mutation, Args, ObjectType, Field } from '@nestjs/graphql';
import { AuthService } from './auth.service';
import { User } from '../users/entities/user.entity';
@ObjectType()
class AuthResponse {
@Field()
access_token: string;
@Field(() => User)
user: User;
}
@Resolver()
export class AuthResolver {
constructor(private authService: AuthService) {}
@Mutation(() => AuthResponse)
async login(
@Args('username') username: string,
@Args('password') password: string,
) {
return this.authService.login(username, password);
}
@Mutation(() => AuthResponse)
async register(
@Args('username') username: string,
@Args('email') email: string,
@Args('password') password: string,
) {
return this.authService.register(username, email, password);
}
}