44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { CreateUserInput } from 'src/graphql/graphql.typings';
|
|
import { Prisma, User } from '@prisma/client';
|
|
import { PrismaService } from 'prisma/prisma.service';
|
|
|
|
@Injectable()
|
|
export class UsersService {
|
|
constructor(private readonly prismaService: PrismaService) {}
|
|
|
|
async user(uniqueInput: Prisma.UserWhereUniqueInput) {
|
|
return await this.prismaService.user.findUnique({ where: uniqueInput });
|
|
}
|
|
|
|
async users(params: {
|
|
skip?: number;
|
|
take?: number;
|
|
cursor?: Prisma.UserWhereUniqueInput;
|
|
where?: Prisma.UserWhereInput;
|
|
orderBy?: Prisma.UserOrderByWithRelationInput;
|
|
}) {
|
|
return await this.prismaService.user.findMany(params);
|
|
}
|
|
|
|
// create(createUserInput: CreateUserInput) {
|
|
// return 'This action adds a new user';
|
|
// }
|
|
|
|
// findAll() {
|
|
// return `This action returns all users`;
|
|
// }
|
|
|
|
// findOne(id: string) {
|
|
// return `This action returns a #${id} user`;
|
|
// }
|
|
|
|
// update(id: string, updateUserInput: UpdateUserInput) {
|
|
// return `This action updates a #${id} user`;
|
|
// }
|
|
|
|
// remove(id: string) {
|
|
// return `This action removes a #${id} user`;
|
|
// }
|
|
}
|