Skip to content

Commit

Permalink
Add service for user
Browse files Browse the repository at this point in the history
  • Loading branch information
devleejb committed Jan 18, 2024
1 parent 19317af commit 58237a4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/src/users/types/user-domain.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export class UserDomain {
id: string;
nickname: string;
createdAt: Date;
updatedAt: Date;
}
15 changes: 15 additions & 0 deletions backend/src/users/users.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
import { Injectable } from "@nestjs/common";
import { User } from "@prisma/client";
import { PrismaService } from "src/db/prisma.service";
import { UserDomain } from "./types/user-domain.type";

@Injectable()
export class UsersService {
constructor(private prismaService: PrismaService) {}

async findOne(userId: string): Promise<UserDomain> {
return await this.prismaService.user.findUnique({
select: {
id: true,
nickname: true,
createdAt: true,
updatedAt: true,
},
where: {
id: userId,
},
});
}

async findOrCreate(
socialProvider: string,
socialUid: string,
Expand Down

0 comments on commit 58237a4

Please sign in to comment.