Removing Prisma and Grapql-nestjs-prisma resolvers (#2574)
* Some cleaning * Fix seeds * Fix all sign in, sign up flow and apiKey optimistic rendering * Fix
This commit is contained in:
@ -1,7 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
|
||||
import { AbilityHandler } from 'src/ability/interfaces/ability-handler.interface';
|
||||
|
||||
export const CHECK_ABILITIES_KEY = 'check_abilities';
|
||||
export const CheckAbilities = (...handlers: AbilityHandler[]) =>
|
||||
SetMetadata(CHECK_ABILITIES_KEY, handlers);
|
||||
@ -1,42 +0,0 @@
|
||||
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
|
||||
import { GqlExecutionContext } from '@nestjs/graphql';
|
||||
|
||||
import merge from 'lodash.merge';
|
||||
|
||||
import {
|
||||
PrismaSelect,
|
||||
ModelSelectMap,
|
||||
DefaultFieldsMap,
|
||||
} from 'src/utils/prisma-select';
|
||||
|
||||
export { PrismaSelect };
|
||||
|
||||
const globalDefaultFields: DefaultFieldsMap = {
|
||||
User: {
|
||||
// Needed for displayName resolve field
|
||||
firstName: true,
|
||||
lastName: true,
|
||||
},
|
||||
Person: {
|
||||
// Needed for displayName resolve field
|
||||
firstName: true,
|
||||
lastName: true,
|
||||
},
|
||||
};
|
||||
|
||||
export const PrismaSelector = createParamDecorator(
|
||||
(
|
||||
data: {
|
||||
modelName: keyof ModelSelectMap;
|
||||
defaultFields?: DefaultFieldsMap;
|
||||
},
|
||||
ctx: ExecutionContext,
|
||||
): PrismaSelect<keyof ModelSelectMap> => {
|
||||
const gqlCtx = GqlExecutionContext.create(ctx);
|
||||
const info = gqlCtx.getInfo();
|
||||
|
||||
return new PrismaSelect(data.modelName, info, {
|
||||
defaultFields: merge(globalDefaultFields, data.defaultFields),
|
||||
});
|
||||
},
|
||||
);
|
||||
Reference in New Issue
Block a user