12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { create } from 'domain';
- import prisma from '../../prisma/PrismaClient';
- import { Prisma } from '@prisma/client';
- interface FindAllParams {
- skip?: number;
- take?: number;
- where?: Prisma.UserKeycloakWhereInput;
- orderBy?: Prisma.UserKeycloakOrderByWithRelationInput;
- }
- const SalesRepository = {
- findAll: async ({ skip, take, where = {} }: FindAllParams) => {
- return prisma.userKeycloak.findMany({
- where: {
- ...where,
- role: 'sales',
- },
- skip,
- take,
- select: {
- id: true,
- fullname: true,
- phone: true,
- role: true,
- },
- });
- },
- countAll: async (where: Prisma.UserKeycloakWhereInput = {}): Promise<number> => {
- return prisma.userKeycloak.count({
- where: {
- ...where,
- role: 'sales',
- }
- });
- },
- };
- export default SalesRepository;
|