This commit is contained in:
2026-06-24 15:34:09 +02:00
commit 65fb6816ca
442 changed files with 27246 additions and 0 deletions
@@ -0,0 +1,638 @@
import { ClassType } from "type-graphql";
import * as tslib from "tslib";
import * as crudResolvers from "./resolvers/crud/resolvers-crud.index";
import * as argsTypes from "./resolvers/crud/args.index";
import * as actionResolvers from "./resolvers/crud/resolvers-actions.index";
import * as relationResolvers from "./resolvers/relations/resolvers.index";
import * as models from "./models";
import * as outputTypes from "./resolvers/outputs";
import * as inputTypes from "./resolvers/inputs";
export type MethodDecoratorOverrideFn = (decorators: MethodDecorator[]) => MethodDecorator[];
const crudResolversMap = {
Post: crudResolvers.PostCrudResolver,
User: crudResolvers.UserCrudResolver,
Upvote: crudResolvers.UpvoteCrudResolver,
Downvote: crudResolvers.DownvoteCrudResolver,
ResetPasswordToken: crudResolvers.ResetPasswordTokenCrudResolver
};
const actionResolversMap = {
Post: {
aggregatePost: actionResolvers.AggregatePostResolver,
createManyPost: actionResolvers.CreateManyPostResolver,
createManyAndReturnPost: actionResolvers.CreateManyAndReturnPostResolver,
createOnePost: actionResolvers.CreateOnePostResolver,
deleteManyPost: actionResolvers.DeleteManyPostResolver,
deleteOnePost: actionResolvers.DeleteOnePostResolver,
findFirstPost: actionResolvers.FindFirstPostResolver,
findFirstPostOrThrow: actionResolvers.FindFirstPostOrThrowResolver,
posts: actionResolvers.FindManyPostResolver,
post: actionResolvers.FindUniquePostResolver,
getPost: actionResolvers.FindUniquePostOrThrowResolver,
groupByPost: actionResolvers.GroupByPostResolver,
updateManyPost: actionResolvers.UpdateManyPostResolver,
updateOnePost: actionResolvers.UpdateOnePostResolver,
upsertOnePost: actionResolvers.UpsertOnePostResolver
},
User: {
aggregateUser: actionResolvers.AggregateUserResolver,
createManyUser: actionResolvers.CreateManyUserResolver,
createManyAndReturnUser: actionResolvers.CreateManyAndReturnUserResolver,
createOneUser: actionResolvers.CreateOneUserResolver,
deleteManyUser: actionResolvers.DeleteManyUserResolver,
deleteOneUser: actionResolvers.DeleteOneUserResolver,
findFirstUser: actionResolvers.FindFirstUserResolver,
findFirstUserOrThrow: actionResolvers.FindFirstUserOrThrowResolver,
users: actionResolvers.FindManyUserResolver,
user: actionResolvers.FindUniqueUserResolver,
getUser: actionResolvers.FindUniqueUserOrThrowResolver,
groupByUser: actionResolvers.GroupByUserResolver,
updateManyUser: actionResolvers.UpdateManyUserResolver,
updateOneUser: actionResolvers.UpdateOneUserResolver,
upsertOneUser: actionResolvers.UpsertOneUserResolver
},
Upvote: {
aggregateUpvote: actionResolvers.AggregateUpvoteResolver,
createManyUpvote: actionResolvers.CreateManyUpvoteResolver,
createManyAndReturnUpvote: actionResolvers.CreateManyAndReturnUpvoteResolver,
createOneUpvote: actionResolvers.CreateOneUpvoteResolver,
deleteManyUpvote: actionResolvers.DeleteManyUpvoteResolver,
deleteOneUpvote: actionResolvers.DeleteOneUpvoteResolver,
findFirstUpvote: actionResolvers.FindFirstUpvoteResolver,
findFirstUpvoteOrThrow: actionResolvers.FindFirstUpvoteOrThrowResolver,
upvotes: actionResolvers.FindManyUpvoteResolver,
upvote: actionResolvers.FindUniqueUpvoteResolver,
getUpvote: actionResolvers.FindUniqueUpvoteOrThrowResolver,
groupByUpvote: actionResolvers.GroupByUpvoteResolver,
updateManyUpvote: actionResolvers.UpdateManyUpvoteResolver,
updateOneUpvote: actionResolvers.UpdateOneUpvoteResolver,
upsertOneUpvote: actionResolvers.UpsertOneUpvoteResolver
},
Downvote: {
aggregateDownvote: actionResolvers.AggregateDownvoteResolver,
createManyDownvote: actionResolvers.CreateManyDownvoteResolver,
createManyAndReturnDownvote: actionResolvers.CreateManyAndReturnDownvoteResolver,
createOneDownvote: actionResolvers.CreateOneDownvoteResolver,
deleteManyDownvote: actionResolvers.DeleteManyDownvoteResolver,
deleteOneDownvote: actionResolvers.DeleteOneDownvoteResolver,
findFirstDownvote: actionResolvers.FindFirstDownvoteResolver,
findFirstDownvoteOrThrow: actionResolvers.FindFirstDownvoteOrThrowResolver,
downvotes: actionResolvers.FindManyDownvoteResolver,
downvote: actionResolvers.FindUniqueDownvoteResolver,
getDownvote: actionResolvers.FindUniqueDownvoteOrThrowResolver,
groupByDownvote: actionResolvers.GroupByDownvoteResolver,
updateManyDownvote: actionResolvers.UpdateManyDownvoteResolver,
updateOneDownvote: actionResolvers.UpdateOneDownvoteResolver,
upsertOneDownvote: actionResolvers.UpsertOneDownvoteResolver
},
ResetPasswordToken: {
aggregateResetPasswordToken: actionResolvers.AggregateResetPasswordTokenResolver,
createManyResetPasswordToken: actionResolvers.CreateManyResetPasswordTokenResolver,
createManyAndReturnResetPasswordToken: actionResolvers.CreateManyAndReturnResetPasswordTokenResolver,
createOneResetPasswordToken: actionResolvers.CreateOneResetPasswordTokenResolver,
deleteManyResetPasswordToken: actionResolvers.DeleteManyResetPasswordTokenResolver,
deleteOneResetPasswordToken: actionResolvers.DeleteOneResetPasswordTokenResolver,
findFirstResetPasswordToken: actionResolvers.FindFirstResetPasswordTokenResolver,
findFirstResetPasswordTokenOrThrow: actionResolvers.FindFirstResetPasswordTokenOrThrowResolver,
resetPasswordTokens: actionResolvers.FindManyResetPasswordTokenResolver,
resetPasswordToken: actionResolvers.FindUniqueResetPasswordTokenResolver,
getResetPasswordToken: actionResolvers.FindUniqueResetPasswordTokenOrThrowResolver,
groupByResetPasswordToken: actionResolvers.GroupByResetPasswordTokenResolver,
updateManyResetPasswordToken: actionResolvers.UpdateManyResetPasswordTokenResolver,
updateOneResetPasswordToken: actionResolvers.UpdateOneResetPasswordTokenResolver,
upsertOneResetPasswordToken: actionResolvers.UpsertOneResetPasswordTokenResolver
}
};
const crudResolversInfo = {
Post: ["aggregatePost", "createManyPost", "createManyAndReturnPost", "createOnePost", "deleteManyPost", "deleteOnePost", "findFirstPost", "findFirstPostOrThrow", "posts", "post", "getPost", "groupByPost", "updateManyPost", "updateOnePost", "upsertOnePost"],
User: ["aggregateUser", "createManyUser", "createManyAndReturnUser", "createOneUser", "deleteManyUser", "deleteOneUser", "findFirstUser", "findFirstUserOrThrow", "users", "user", "getUser", "groupByUser", "updateManyUser", "updateOneUser", "upsertOneUser"],
Upvote: ["aggregateUpvote", "createManyUpvote", "createManyAndReturnUpvote", "createOneUpvote", "deleteManyUpvote", "deleteOneUpvote", "findFirstUpvote", "findFirstUpvoteOrThrow", "upvotes", "upvote", "getUpvote", "groupByUpvote", "updateManyUpvote", "updateOneUpvote", "upsertOneUpvote"],
Downvote: ["aggregateDownvote", "createManyDownvote", "createManyAndReturnDownvote", "createOneDownvote", "deleteManyDownvote", "deleteOneDownvote", "findFirstDownvote", "findFirstDownvoteOrThrow", "downvotes", "downvote", "getDownvote", "groupByDownvote", "updateManyDownvote", "updateOneDownvote", "upsertOneDownvote"],
ResetPasswordToken: ["aggregateResetPasswordToken", "createManyResetPasswordToken", "createManyAndReturnResetPasswordToken", "createOneResetPasswordToken", "deleteManyResetPasswordToken", "deleteOneResetPasswordToken", "findFirstResetPasswordToken", "findFirstResetPasswordTokenOrThrow", "resetPasswordTokens", "resetPasswordToken", "getResetPasswordToken", "groupByResetPasswordToken", "updateManyResetPasswordToken", "updateOneResetPasswordToken", "upsertOneResetPasswordToken"]
};
const argsInfo = {
AggregatePostArgs: ["where", "orderBy", "cursor", "take", "skip"],
CreateManyPostArgs: ["data", "skipDuplicates"],
CreateManyAndReturnPostArgs: ["data", "skipDuplicates"],
CreateOnePostArgs: ["data"],
DeleteManyPostArgs: ["where"],
DeleteOnePostArgs: ["where"],
FindFirstPostArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindFirstPostOrThrowArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindManyPostArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindUniquePostArgs: ["where"],
FindUniquePostOrThrowArgs: ["where"],
GroupByPostArgs: ["where", "orderBy", "by", "having", "take", "skip"],
UpdateManyPostArgs: ["data", "where"],
UpdateOnePostArgs: ["data", "where"],
UpsertOnePostArgs: ["where", "create", "update"],
AggregateUserArgs: ["where", "orderBy", "cursor", "take", "skip"],
CreateManyUserArgs: ["data", "skipDuplicates"],
CreateManyAndReturnUserArgs: ["data", "skipDuplicates"],
CreateOneUserArgs: ["data"],
DeleteManyUserArgs: ["where"],
DeleteOneUserArgs: ["where"],
FindFirstUserArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindFirstUserOrThrowArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindManyUserArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindUniqueUserArgs: ["where"],
FindUniqueUserOrThrowArgs: ["where"],
GroupByUserArgs: ["where", "orderBy", "by", "having", "take", "skip"],
UpdateManyUserArgs: ["data", "where"],
UpdateOneUserArgs: ["data", "where"],
UpsertOneUserArgs: ["where", "create", "update"],
AggregateUpvoteArgs: ["where", "orderBy", "cursor", "take", "skip"],
CreateManyUpvoteArgs: ["data", "skipDuplicates"],
CreateManyAndReturnUpvoteArgs: ["data", "skipDuplicates"],
CreateOneUpvoteArgs: ["data"],
DeleteManyUpvoteArgs: ["where"],
DeleteOneUpvoteArgs: ["where"],
FindFirstUpvoteArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindFirstUpvoteOrThrowArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindManyUpvoteArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindUniqueUpvoteArgs: ["where"],
FindUniqueUpvoteOrThrowArgs: ["where"],
GroupByUpvoteArgs: ["where", "orderBy", "by", "having", "take", "skip"],
UpdateManyUpvoteArgs: ["data", "where"],
UpdateOneUpvoteArgs: ["data", "where"],
UpsertOneUpvoteArgs: ["where", "create", "update"],
AggregateDownvoteArgs: ["where", "orderBy", "cursor", "take", "skip"],
CreateManyDownvoteArgs: ["data", "skipDuplicates"],
CreateManyAndReturnDownvoteArgs: ["data", "skipDuplicates"],
CreateOneDownvoteArgs: ["data"],
DeleteManyDownvoteArgs: ["where"],
DeleteOneDownvoteArgs: ["where"],
FindFirstDownvoteArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindFirstDownvoteOrThrowArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindManyDownvoteArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindUniqueDownvoteArgs: ["where"],
FindUniqueDownvoteOrThrowArgs: ["where"],
GroupByDownvoteArgs: ["where", "orderBy", "by", "having", "take", "skip"],
UpdateManyDownvoteArgs: ["data", "where"],
UpdateOneDownvoteArgs: ["data", "where"],
UpsertOneDownvoteArgs: ["where", "create", "update"],
AggregateResetPasswordTokenArgs: ["where", "orderBy", "cursor", "take", "skip"],
CreateManyResetPasswordTokenArgs: ["data", "skipDuplicates"],
CreateManyAndReturnResetPasswordTokenArgs: ["data", "skipDuplicates"],
CreateOneResetPasswordTokenArgs: ["data"],
DeleteManyResetPasswordTokenArgs: ["where"],
DeleteOneResetPasswordTokenArgs: ["where"],
FindFirstResetPasswordTokenArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindFirstResetPasswordTokenOrThrowArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindManyResetPasswordTokenArgs: ["where", "orderBy", "cursor", "take", "skip", "distinct"],
FindUniqueResetPasswordTokenArgs: ["where"],
FindUniqueResetPasswordTokenOrThrowArgs: ["where"],
GroupByResetPasswordTokenArgs: ["where", "orderBy", "by", "having", "take", "skip"],
UpdateManyResetPasswordTokenArgs: ["data", "where"],
UpdateOneResetPasswordTokenArgs: ["data", "where"],
UpsertOneResetPasswordTokenArgs: ["where", "create", "update"]
};
type ResolverModelNames = keyof typeof crudResolversMap;
type ModelResolverActionNames<
TModel extends ResolverModelNames
> = keyof typeof crudResolversMap[TModel]["prototype"];
export type ResolverActionsConfig<
TModel extends ResolverModelNames
> = Partial<Record<ModelResolverActionNames<TModel>, MethodDecorator[] | MethodDecoratorOverrideFn>>
& {
_all?: MethodDecorator[];
_query?: MethodDecorator[];
_mutation?: MethodDecorator[];
};
export type ResolversEnhanceMap = {
[TModel in ResolverModelNames]?: ResolverActionsConfig<TModel>;
};
export function applyResolversEnhanceMap(
resolversEnhanceMap: ResolversEnhanceMap,
) {
const mutationOperationPrefixes = [
"createOne", "createMany", "createManyAndReturn", "deleteOne", "updateOne", "deleteMany", "updateMany", "upsertOne"
];
for (const resolversEnhanceMapKey of Object.keys(resolversEnhanceMap)) {
const modelName = resolversEnhanceMapKey as keyof typeof resolversEnhanceMap;
const crudTarget = crudResolversMap[modelName].prototype;
const resolverActionsConfig = resolversEnhanceMap[modelName]!;
const actionResolversConfig = actionResolversMap[modelName];
const allActionsDecorators = resolverActionsConfig._all;
const resolverActionNames = crudResolversInfo[modelName as keyof typeof crudResolversInfo];
for (const resolverActionName of resolverActionNames) {
const maybeDecoratorsOrFn = resolverActionsConfig[
resolverActionName as keyof typeof resolverActionsConfig
] as MethodDecorator[] | MethodDecoratorOverrideFn | undefined;
const isWriteOperation = mutationOperationPrefixes.some(prefix => resolverActionName.startsWith(prefix));
const operationKindDecorators = isWriteOperation ? resolverActionsConfig._mutation : resolverActionsConfig._query;
const mainDecorators = [
...allActionsDecorators ?? [],
...operationKindDecorators ?? [],
]
let decorators: MethodDecorator[];
if (typeof maybeDecoratorsOrFn === "function") {
decorators = maybeDecoratorsOrFn(mainDecorators);
} else {
decorators = [...mainDecorators, ...maybeDecoratorsOrFn ?? []];
}
const actionTarget = (actionResolversConfig[
resolverActionName as keyof typeof actionResolversConfig
] as Function).prototype;
tslib.__decorate(decorators, crudTarget, resolverActionName, null);
tslib.__decorate(decorators, actionTarget, resolverActionName, null);
}
}
}
type ArgsTypesNames = keyof typeof argsTypes;
type ArgFieldNames<TArgsType extends ArgsTypesNames> = Exclude<
keyof typeof argsTypes[TArgsType]["prototype"],
number | symbol
>;
type ArgFieldsConfig<
TArgsType extends ArgsTypesNames
> = FieldsConfig<ArgFieldNames<TArgsType>>;
export type ArgConfig<TArgsType extends ArgsTypesNames> = {
class?: ClassDecorator[];
fields?: ArgFieldsConfig<TArgsType>;
};
export type ArgsTypesEnhanceMap = {
[TArgsType in ArgsTypesNames]?: ArgConfig<TArgsType>;
};
export function applyArgsTypesEnhanceMap(
argsTypesEnhanceMap: ArgsTypesEnhanceMap,
) {
for (const argsTypesEnhanceMapKey of Object.keys(argsTypesEnhanceMap)) {
const argsTypeName = argsTypesEnhanceMapKey as keyof typeof argsTypesEnhanceMap;
const typeConfig = argsTypesEnhanceMap[argsTypeName]!;
const typeClass = argsTypes[argsTypeName];
const typeTarget = typeClass.prototype;
applyTypeClassEnhanceConfig(
typeConfig,
typeClass,
typeTarget,
argsInfo[argsTypeName as keyof typeof argsInfo],
);
}
}
const relationResolversMap = {
Post: relationResolvers.PostRelationsResolver,
User: relationResolvers.UserRelationsResolver
};
const relationResolversInfo = {
Post: ["author"],
User: ["Posts"]
};
type RelationResolverModelNames = keyof typeof relationResolversMap;
type RelationResolverActionNames<
TModel extends RelationResolverModelNames
> = keyof typeof relationResolversMap[TModel]["prototype"];
export type RelationResolverActionsConfig<TModel extends RelationResolverModelNames>
= Partial<Record<RelationResolverActionNames<TModel>, MethodDecorator[] | MethodDecoratorOverrideFn>>
& { _all?: MethodDecorator[] };
export type RelationResolversEnhanceMap = {
[TModel in RelationResolverModelNames]?: RelationResolverActionsConfig<TModel>;
};
export function applyRelationResolversEnhanceMap(
relationResolversEnhanceMap: RelationResolversEnhanceMap,
) {
for (const relationResolversEnhanceMapKey of Object.keys(relationResolversEnhanceMap)) {
const modelName = relationResolversEnhanceMapKey as keyof typeof relationResolversEnhanceMap;
const relationResolverTarget = relationResolversMap[modelName].prototype;
const relationResolverActionsConfig = relationResolversEnhanceMap[modelName]!;
const allActionsDecorators = relationResolverActionsConfig._all ?? [];
const relationResolverActionNames = relationResolversInfo[modelName as keyof typeof relationResolversInfo];
for (const relationResolverActionName of relationResolverActionNames) {
const maybeDecoratorsOrFn = relationResolverActionsConfig[
relationResolverActionName as keyof typeof relationResolverActionsConfig
] as MethodDecorator[] | MethodDecoratorOverrideFn | undefined;
let decorators: MethodDecorator[];
if (typeof maybeDecoratorsOrFn === "function") {
decorators = maybeDecoratorsOrFn(allActionsDecorators);
} else {
decorators = [...allActionsDecorators, ...maybeDecoratorsOrFn ?? []];
}
tslib.__decorate(decorators, relationResolverTarget, relationResolverActionName, null);
}
}
}
type TypeConfig = {
class?: ClassDecorator[];
fields?: FieldsConfig;
};
export type PropertyDecoratorOverrideFn = (decorators: PropertyDecorator[]) => PropertyDecorator[];
type FieldsConfig<TTypeKeys extends string = string> = Partial<
Record<TTypeKeys, PropertyDecorator[] | PropertyDecoratorOverrideFn>
> & { _all?: PropertyDecorator[] };
function applyTypeClassEnhanceConfig<
TEnhanceConfig extends TypeConfig,
TType extends object
>(
enhanceConfig: TEnhanceConfig,
typeClass: ClassType<TType>,
typePrototype: TType,
typeFieldNames: string[]
) {
if (enhanceConfig.class) {
tslib.__decorate(enhanceConfig.class, typeClass);
}
if (enhanceConfig.fields) {
const allFieldsDecorators = enhanceConfig.fields._all ?? [];
for (const typeFieldName of typeFieldNames) {
const maybeDecoratorsOrFn = enhanceConfig.fields[
typeFieldName
] as PropertyDecorator[] | PropertyDecoratorOverrideFn | undefined;
let decorators: PropertyDecorator[];
if (typeof maybeDecoratorsOrFn === "function") {
decorators = maybeDecoratorsOrFn(allFieldsDecorators);
} else {
decorators = [...allFieldsDecorators, ...maybeDecoratorsOrFn ?? []];
}
tslib.__decorate(decorators, typePrototype, typeFieldName, void 0);
}
}
}
const modelsInfo = {
Post: ["id", "createdAt", "updatedAt", "title", "content", "authorID", "points"],
User: ["id", "createdAt", "updatedAt", "username", "password", "email"],
Upvote: ["userID", "postID"],
Downvote: ["userID", "postID"],
ResetPasswordToken: ["id", "userID", "value"]
};
type ModelNames = keyof typeof models;
type ModelFieldNames<TModel extends ModelNames> = Exclude<
keyof typeof models[TModel]["prototype"],
number | symbol
>;
type ModelFieldsConfig<TModel extends ModelNames> = FieldsConfig<
ModelFieldNames<TModel>
>;
export type ModelConfig<TModel extends ModelNames> = {
class?: ClassDecorator[];
fields?: ModelFieldsConfig<TModel>;
};
export type ModelsEnhanceMap = {
[TModel in ModelNames]?: ModelConfig<TModel>;
};
export function applyModelsEnhanceMap(modelsEnhanceMap: ModelsEnhanceMap) {
for (const modelsEnhanceMapKey of Object.keys(modelsEnhanceMap)) {
const modelName = modelsEnhanceMapKey as keyof typeof modelsEnhanceMap;
const modelConfig = modelsEnhanceMap[modelName]!;
const modelClass = models[modelName];
const modelTarget = modelClass.prototype;
applyTypeClassEnhanceConfig(
modelConfig,
modelClass,
modelTarget,
modelsInfo[modelName as keyof typeof modelsInfo],
);
}
}
const outputsInfo = {
AggregatePost: ["_count", "_avg", "_sum", "_min", "_max"],
PostGroupBy: ["id", "createdAt", "updatedAt", "title", "content", "authorID", "points", "_count", "_avg", "_sum", "_min", "_max"],
AggregateUser: ["_count", "_min", "_max"],
UserGroupBy: ["id", "createdAt", "updatedAt", "username", "password", "email", "_count", "_min", "_max"],
AggregateUpvote: ["_count", "_min", "_max"],
UpvoteGroupBy: ["userID", "postID", "_count", "_min", "_max"],
AggregateDownvote: ["_count", "_min", "_max"],
DownvoteGroupBy: ["userID", "postID", "_count", "_min", "_max"],
AggregateResetPasswordToken: ["_count", "_min", "_max"],
ResetPasswordTokenGroupBy: ["id", "userID", "value", "_count", "_min", "_max"],
AffectedRowsOutput: ["count"],
PostCountAggregate: ["id", "createdAt", "updatedAt", "title", "content", "authorID", "points", "_all"],
PostAvgAggregate: ["points"],
PostSumAggregate: ["points"],
PostMinAggregate: ["id", "createdAt", "updatedAt", "title", "content", "authorID", "points"],
PostMaxAggregate: ["id", "createdAt", "updatedAt", "title", "content", "authorID", "points"],
UserCount: ["Posts"],
UserCountAggregate: ["id", "createdAt", "updatedAt", "username", "password", "email", "_all"],
UserMinAggregate: ["id", "createdAt", "updatedAt", "username", "password", "email"],
UserMaxAggregate: ["id", "createdAt", "updatedAt", "username", "password", "email"],
UpvoteCountAggregate: ["userID", "postID", "_all"],
UpvoteMinAggregate: ["userID", "postID"],
UpvoteMaxAggregate: ["userID", "postID"],
DownvoteCountAggregate: ["userID", "postID", "_all"],
DownvoteMinAggregate: ["userID", "postID"],
DownvoteMaxAggregate: ["userID", "postID"],
ResetPasswordTokenCountAggregate: ["id", "userID", "value", "_all"],
ResetPasswordTokenMinAggregate: ["id", "userID", "value"],
ResetPasswordTokenMaxAggregate: ["id", "userID", "value"],
CreateManyAndReturnPost: ["id", "createdAt", "updatedAt", "title", "content", "authorID", "points", "author"],
CreateManyAndReturnUser: ["id", "createdAt", "updatedAt", "username", "password", "email"],
CreateManyAndReturnUpvote: ["userID", "postID"],
CreateManyAndReturnDownvote: ["userID", "postID"],
CreateManyAndReturnResetPasswordToken: ["id", "userID", "value"]
};
type OutputTypesNames = keyof typeof outputTypes;
type OutputTypeFieldNames<TOutput extends OutputTypesNames> = Exclude<
keyof typeof outputTypes[TOutput]["prototype"],
number | symbol
>;
type OutputTypeFieldsConfig<
TOutput extends OutputTypesNames
> = FieldsConfig<OutputTypeFieldNames<TOutput>>;
export type OutputTypeConfig<TOutput extends OutputTypesNames> = {
class?: ClassDecorator[];
fields?: OutputTypeFieldsConfig<TOutput>;
};
export type OutputTypesEnhanceMap = {
[TOutput in OutputTypesNames]?: OutputTypeConfig<TOutput>;
};
export function applyOutputTypesEnhanceMap(
outputTypesEnhanceMap: OutputTypesEnhanceMap,
) {
for (const outputTypeEnhanceMapKey of Object.keys(outputTypesEnhanceMap)) {
const outputTypeName = outputTypeEnhanceMapKey as keyof typeof outputTypesEnhanceMap;
const typeConfig = outputTypesEnhanceMap[outputTypeName]!;
const typeClass = outputTypes[outputTypeName];
const typeTarget = typeClass.prototype;
applyTypeClassEnhanceConfig(
typeConfig,
typeClass,
typeTarget,
outputsInfo[outputTypeName as keyof typeof outputsInfo],
);
}
}
const inputsInfo = {
PostWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "title", "content", "authorID", "points", "author"],
PostOrderByWithRelationInput: ["id", "createdAt", "updatedAt", "title", "content", "authorID", "points", "author"],
PostWhereUniqueInput: ["id", "createdAt", "updatedAt", "AND", "OR", "NOT", "title", "content", "authorID", "points", "author"],
PostOrderByWithAggregationInput: ["id", "createdAt", "updatedAt", "title", "content", "authorID", "points", "_count", "_avg", "_max", "_min", "_sum"],
PostScalarWhereWithAggregatesInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "title", "content", "authorID", "points"],
UserWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "username", "password", "email", "Posts"],
UserOrderByWithRelationInput: ["id", "createdAt", "updatedAt", "username", "password", "email", "Posts"],
UserWhereUniqueInput: ["id", "username", "email", "AND", "OR", "NOT", "createdAt", "updatedAt", "password", "Posts"],
UserOrderByWithAggregationInput: ["id", "createdAt", "updatedAt", "username", "password", "email", "_count", "_max", "_min"],
UserScalarWhereWithAggregatesInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "username", "password", "email"],
UpvoteWhereInput: ["AND", "OR", "NOT", "userID", "postID"],
UpvoteOrderByWithRelationInput: ["userID", "postID"],
UpvoteWhereUniqueInput: ["userID_postID", "AND", "OR", "NOT", "userID", "postID"],
UpvoteOrderByWithAggregationInput: ["userID", "postID", "_count", "_max", "_min"],
UpvoteScalarWhereWithAggregatesInput: ["AND", "OR", "NOT", "userID", "postID"],
DownvoteWhereInput: ["AND", "OR", "NOT", "userID", "postID"],
DownvoteOrderByWithRelationInput: ["userID", "postID"],
DownvoteWhereUniqueInput: ["userID_postID", "AND", "OR", "NOT", "userID", "postID"],
DownvoteOrderByWithAggregationInput: ["userID", "postID", "_count", "_max", "_min"],
DownvoteScalarWhereWithAggregatesInput: ["AND", "OR", "NOT", "userID", "postID"],
ResetPasswordTokenWhereInput: ["AND", "OR", "NOT", "id", "userID", "value"],
ResetPasswordTokenOrderByWithRelationInput: ["id", "userID", "value"],
ResetPasswordTokenWhereUniqueInput: ["id", "value", "userID_value", "AND", "OR", "NOT", "userID"],
ResetPasswordTokenOrderByWithAggregationInput: ["id", "userID", "value", "_count", "_max", "_min"],
ResetPasswordTokenScalarWhereWithAggregatesInput: ["AND", "OR", "NOT", "id", "userID", "value"],
PostCreateInput: ["id", "createdAt", "updatedAt", "title", "content", "points", "author"],
PostUpdateInput: ["id", "createdAt", "updatedAt", "title", "content", "points", "author"],
PostCreateManyInput: ["id", "createdAt", "updatedAt", "title", "content", "authorID", "points"],
PostUpdateManyMutationInput: ["id", "createdAt", "updatedAt", "title", "content", "points"],
UserCreateInput: ["id", "createdAt", "updatedAt", "username", "password", "email", "Posts"],
UserUpdateInput: ["id", "createdAt", "updatedAt", "username", "password", "email", "Posts"],
UserCreateManyInput: ["id", "createdAt", "updatedAt", "username", "password", "email"],
UserUpdateManyMutationInput: ["id", "createdAt", "updatedAt", "username", "password", "email"],
UpvoteCreateInput: ["userID", "postID"],
UpvoteUpdateInput: ["userID", "postID"],
UpvoteCreateManyInput: ["userID", "postID"],
UpvoteUpdateManyMutationInput: ["userID", "postID"],
DownvoteCreateInput: ["userID", "postID"],
DownvoteUpdateInput: ["userID", "postID"],
DownvoteCreateManyInput: ["userID", "postID"],
DownvoteUpdateManyMutationInput: ["userID", "postID"],
ResetPasswordTokenCreateInput: ["id", "userID", "value"],
ResetPasswordTokenUpdateInput: ["id", "userID", "value"],
ResetPasswordTokenCreateManyInput: ["id", "userID", "value"],
ResetPasswordTokenUpdateManyMutationInput: ["id", "userID", "value"],
StringFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "mode", "not"],
DateTimeFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
StringNullableFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "mode", "not"],
IntFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
UserRelationFilter: ["is", "isNot"],
SortOrderInput: ["sort", "nulls"],
PostCountOrderByAggregateInput: ["id", "createdAt", "updatedAt", "title", "content", "authorID", "points"],
PostAvgOrderByAggregateInput: ["points"],
PostMaxOrderByAggregateInput: ["id", "createdAt", "updatedAt", "title", "content", "authorID", "points"],
PostMinOrderByAggregateInput: ["id", "createdAt", "updatedAt", "title", "content", "authorID", "points"],
PostSumOrderByAggregateInput: ["points"],
StringWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "mode", "not", "_count", "_min", "_max"],
DateTimeWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not", "_count", "_min", "_max"],
StringNullableWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "mode", "not", "_count", "_min", "_max"],
IntWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not", "_count", "_avg", "_sum", "_min", "_max"],
PostListRelationFilter: ["every", "some", "none"],
PostOrderByRelationAggregateInput: ["_count"],
UserCountOrderByAggregateInput: ["id", "createdAt", "updatedAt", "username", "password", "email"],
UserMaxOrderByAggregateInput: ["id", "createdAt", "updatedAt", "username", "password", "email"],
UserMinOrderByAggregateInput: ["id", "createdAt", "updatedAt", "username", "password", "email"],
UpvoteUserIDPostIDCompoundUniqueInput: ["userID", "postID"],
UpvoteCountOrderByAggregateInput: ["userID", "postID"],
UpvoteMaxOrderByAggregateInput: ["userID", "postID"],
UpvoteMinOrderByAggregateInput: ["userID", "postID"],
DownvoteUserIDPostIDCompoundUniqueInput: ["userID", "postID"],
DownvoteCountOrderByAggregateInput: ["userID", "postID"],
DownvoteMaxOrderByAggregateInput: ["userID", "postID"],
DownvoteMinOrderByAggregateInput: ["userID", "postID"],
ResetPasswordTokenUserIDValueCompoundUniqueInput: ["userID", "value"],
ResetPasswordTokenCountOrderByAggregateInput: ["id", "userID", "value"],
ResetPasswordTokenMaxOrderByAggregateInput: ["id", "userID", "value"],
ResetPasswordTokenMinOrderByAggregateInput: ["id", "userID", "value"],
UserCreateNestedOneWithoutPostsInput: ["create", "connectOrCreate", "connect"],
StringFieldUpdateOperationsInput: ["set"],
DateTimeFieldUpdateOperationsInput: ["set"],
NullableStringFieldUpdateOperationsInput: ["set"],
IntFieldUpdateOperationsInput: ["set", "increment", "decrement", "multiply", "divide"],
UserUpdateOneRequiredWithoutPostsNestedInput: ["create", "connectOrCreate", "upsert", "connect", "update"],
PostCreateNestedManyWithoutAuthorInput: ["create", "connectOrCreate", "createMany", "connect"],
PostUpdateManyWithoutAuthorNestedInput: ["create", "connectOrCreate", "upsert", "createMany", "set", "disconnect", "delete", "connect", "update", "updateMany", "deleteMany"],
NestedStringFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "not"],
NestedDateTimeFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
NestedStringNullableFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "not"],
NestedIntFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
NestedStringWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "not", "_count", "_min", "_max"],
NestedDateTimeWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not", "_count", "_min", "_max"],
NestedStringNullableWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "contains", "startsWith", "endsWith", "not", "_count", "_min", "_max"],
NestedIntNullableFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
NestedIntWithAggregatesFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not", "_count", "_avg", "_sum", "_min", "_max"],
NestedFloatFilter: ["equals", "in", "notIn", "lt", "lte", "gt", "gte", "not"],
UserCreateWithoutPostsInput: ["id", "createdAt", "updatedAt", "username", "password", "email"],
UserCreateOrConnectWithoutPostsInput: ["where", "create"],
UserUpsertWithoutPostsInput: ["update", "create", "where"],
UserUpdateToOneWithWhereWithoutPostsInput: ["where", "data"],
UserUpdateWithoutPostsInput: ["id", "createdAt", "updatedAt", "username", "password", "email"],
PostCreateWithoutAuthorInput: ["id", "createdAt", "updatedAt", "title", "content", "points"],
PostCreateOrConnectWithoutAuthorInput: ["where", "create"],
PostCreateManyAuthorInputEnvelope: ["data", "skipDuplicates"],
PostUpsertWithWhereUniqueWithoutAuthorInput: ["where", "update", "create"],
PostUpdateWithWhereUniqueWithoutAuthorInput: ["where", "data"],
PostUpdateManyWithWhereWithoutAuthorInput: ["where", "data"],
PostScalarWhereInput: ["AND", "OR", "NOT", "id", "createdAt", "updatedAt", "title", "content", "authorID", "points"],
PostCreateManyAuthorInput: ["id", "createdAt", "updatedAt", "title", "content", "points"],
PostUpdateWithoutAuthorInput: ["id", "createdAt", "updatedAt", "title", "content", "points"]
};
type InputTypesNames = keyof typeof inputTypes;
type InputTypeFieldNames<TInput extends InputTypesNames> = Exclude<
keyof typeof inputTypes[TInput]["prototype"],
number | symbol
>;
type InputTypeFieldsConfig<
TInput extends InputTypesNames
> = FieldsConfig<InputTypeFieldNames<TInput>>;
export type InputTypeConfig<TInput extends InputTypesNames> = {
class?: ClassDecorator[];
fields?: InputTypeFieldsConfig<TInput>;
};
export type InputTypesEnhanceMap = {
[TInput in InputTypesNames]?: InputTypeConfig<TInput>;
};
export function applyInputTypesEnhanceMap(
inputTypesEnhanceMap: InputTypesEnhanceMap,
) {
for (const inputTypeEnhanceMapKey of Object.keys(inputTypesEnhanceMap)) {
const inputTypeName = inputTypeEnhanceMapKey as keyof typeof inputTypesEnhanceMap;
const typeConfig = inputTypesEnhanceMap[inputTypeName]!;
const typeClass = inputTypes[inputTypeName];
const typeTarget = typeClass.prototype;
applyTypeClassEnhanceConfig(
typeConfig,
typeClass,
typeTarget,
inputsInfo[inputTypeName as keyof typeof inputsInfo],
);
}
}
@@ -0,0 +1,10 @@
import * as TypeGraphQL from "type-graphql";
export enum DownvoteScalarFieldEnum {
userID = "userID",
postID = "postID"
}
TypeGraphQL.registerEnumType(DownvoteScalarFieldEnum, {
name: "DownvoteScalarFieldEnum",
description: undefined,
});
@@ -0,0 +1,10 @@
import * as TypeGraphQL from "type-graphql";
export enum NullsOrder {
first = "first",
last = "last"
}
TypeGraphQL.registerEnumType(NullsOrder, {
name: "NullsOrder",
description: undefined,
});
@@ -0,0 +1,15 @@
import * as TypeGraphQL from "type-graphql";
export enum PostScalarFieldEnum {
id = "id",
createdAt = "createdAt",
updatedAt = "updatedAt",
title = "title",
content = "content",
authorID = "authorID",
points = "points"
}
TypeGraphQL.registerEnumType(PostScalarFieldEnum, {
name: "PostScalarFieldEnum",
description: undefined,
});
@@ -0,0 +1,10 @@
import * as TypeGraphQL from "type-graphql";
export enum QueryMode {
"default" = "default",
insensitive = "insensitive"
}
TypeGraphQL.registerEnumType(QueryMode, {
name: "QueryMode",
description: undefined,
});
@@ -0,0 +1,11 @@
import * as TypeGraphQL from "type-graphql";
export enum ResetPasswordTokenScalarFieldEnum {
id = "id",
userID = "userID",
value = "value"
}
TypeGraphQL.registerEnumType(ResetPasswordTokenScalarFieldEnum, {
name: "ResetPasswordTokenScalarFieldEnum",
description: undefined,
});
@@ -0,0 +1,10 @@
import * as TypeGraphQL from "type-graphql";
export enum SortOrder {
asc = "asc",
desc = "desc"
}
TypeGraphQL.registerEnumType(SortOrder, {
name: "SortOrder",
description: undefined,
});
@@ -0,0 +1,12 @@
import * as TypeGraphQL from "type-graphql";
export enum TransactionIsolationLevel {
ReadUncommitted = "ReadUncommitted",
ReadCommitted = "ReadCommitted",
RepeatableRead = "RepeatableRead",
Serializable = "Serializable"
}
TypeGraphQL.registerEnumType(TransactionIsolationLevel, {
name: "TransactionIsolationLevel",
description: undefined,
});
@@ -0,0 +1,10 @@
import * as TypeGraphQL from "type-graphql";
export enum UpvoteScalarFieldEnum {
userID = "userID",
postID = "postID"
}
TypeGraphQL.registerEnumType(UpvoteScalarFieldEnum, {
name: "UpvoteScalarFieldEnum",
description: undefined,
});
@@ -0,0 +1,14 @@
import * as TypeGraphQL from "type-graphql";
export enum UserScalarFieldEnum {
id = "id",
createdAt = "createdAt",
updatedAt = "updatedAt",
username = "username",
password = "password",
email = "email"
}
TypeGraphQL.registerEnumType(UserScalarFieldEnum, {
name: "UserScalarFieldEnum",
description: undefined,
});
@@ -0,0 +1,9 @@
export { DownvoteScalarFieldEnum } from "./DownvoteScalarFieldEnum";
export { NullsOrder } from "./NullsOrder";
export { PostScalarFieldEnum } from "./PostScalarFieldEnum";
export { QueryMode } from "./QueryMode";
export { ResetPasswordTokenScalarFieldEnum } from "./ResetPasswordTokenScalarFieldEnum";
export { SortOrder } from "./SortOrder";
export { TransactionIsolationLevel } from "./TransactionIsolationLevel";
export { UpvoteScalarFieldEnum } from "./UpvoteScalarFieldEnum";
export { UserScalarFieldEnum } from "./UserScalarFieldEnum";
@@ -0,0 +1,61 @@
import type { GraphQLResolveInfo } from "graphql";
import graphqlFields from "graphql-fields";
export function transformInfoIntoPrismaArgs(info: GraphQLResolveInfo): Record<string, any> {
const fields: Record<string, any> = graphqlFields(
// suppress GraphQLResolveInfo types issue
info as any,
{},
{
excludedFields: ['__typename'],
processArguments: true,
}
);
return transformFields(fields);
}
function transformFields(fields: Record<string, any>): Record<string, any> {
return Object.fromEntries(
Object.entries(fields)
.map<[string, any]>(([key, value]) => {
if (Object.keys(value).length === 0) {
return [key, true];
}
if ("__arguments" in value) {
return [key, Object.fromEntries(
value.__arguments.map((argument: object) => {
const [[key, { value }]] = Object.entries(argument);
return [key, value];
})
)];
}
return [key, transformFields(value)];
}),
);
}
export function getPrismaFromContext(context: any) {
const prismaClient = context["prisma"];
if (!prismaClient) {
throw new Error("Unable to find Prisma Client in GraphQL context. Please provide it under the `context[\"prisma\"]` key.");
}
return prismaClient;
}
export function transformCountFieldIntoSelectRelationsCount(_count: object) {
return {
include: {
_count: {
select: {
...Object.fromEntries(
Object.entries(_count).filter(([_, v]) => v != null)
),
}
},
},
}
}
@@ -0,0 +1,23 @@
import * as crudResolversImport from "./resolvers/crud/resolvers-crud.index";
import * as relationResolversImport from "./resolvers/relations/resolvers.index";
import { NonEmptyArray } from "type-graphql";
export * from "./enums";
export * from "./models";
export * from "./resolvers/crud";
export const crudResolvers = Object.values(crudResolversImport) as unknown as NonEmptyArray<Function>;
export * from "./resolvers/relations";
export const relationResolvers = Object.values(relationResolversImport) as unknown as NonEmptyArray<Function>;
export * from "./resolvers/inputs";
export * from "./resolvers/outputs";
export * from "./enhance";
export * from "./scalars";
export const resolvers = [
...crudResolvers,
...relationResolvers,
] as unknown as NonEmptyArray<Function>;
@@ -0,0 +1,17 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { Prisma } from "@prisma/client";
import { DecimalJSScalar } from "../scalars";
@TypeGraphQL.ObjectType("Downvote", {})
export class Downvote {
@TypeGraphQL.Field(_type => String, {
nullable: false
})
userID!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
postID!: string;
}
@@ -0,0 +1,45 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { Prisma } from "@prisma/client";
import { DecimalJSScalar } from "../scalars";
import { User } from "../models/User";
@TypeGraphQL.ObjectType("Post", {})
export class Post {
@TypeGraphQL.Field(_type => String, {
nullable: false
})
id!: string;
@TypeGraphQL.Field(_type => Date, {
nullable: false
})
createdAt!: Date;
@TypeGraphQL.Field(_type => Date, {
nullable: false
})
updatedAt!: Date;
@TypeGraphQL.Field(_type => String, {
nullable: true
})
title?: string | null;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
content!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
authorID!: string;
author?: User;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: false
})
points!: number;
}
@@ -0,0 +1,22 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { Prisma } from "@prisma/client";
import { DecimalJSScalar } from "../scalars";
@TypeGraphQL.ObjectType("ResetPasswordToken", {})
export class ResetPasswordToken {
@TypeGraphQL.Field(_type => String, {
nullable: false
})
id!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
userID!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
value!: string;
}
@@ -0,0 +1,17 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { Prisma } from "@prisma/client";
import { DecimalJSScalar } from "../scalars";
@TypeGraphQL.ObjectType("Upvote", {})
export class Upvote {
@TypeGraphQL.Field(_type => String, {
nullable: false
})
userID!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
postID!: string;
}
@@ -0,0 +1,46 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { Prisma } from "@prisma/client";
import { DecimalJSScalar } from "../scalars";
import { Post } from "../models/Post";
import { UserCount } from "../resolvers/outputs/UserCount";
@TypeGraphQL.ObjectType("User", {})
export class User {
@TypeGraphQL.Field(_type => String, {
nullable: false
})
id!: string;
@TypeGraphQL.Field(_type => Date, {
nullable: false
})
createdAt!: Date;
@TypeGraphQL.Field(_type => Date, {
nullable: false
})
updatedAt!: Date;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
username!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
password!: string;
@TypeGraphQL.Field(_type => String, {
nullable: true
})
email?: string | null;
Posts?: Post[];
@TypeGraphQL.Field(_type => UserCount, {
nullable: true
})
_count?: UserCount | null;
}
@@ -0,0 +1,5 @@
export { Downvote } from "./Downvote";
export { Post } from "./Post";
export { ResetPasswordToken } from "./ResetPasswordToken";
export { Upvote } from "./Upvote";
export { User } from "./User";
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { AggregateDownvoteArgs } from "./args/AggregateDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { AggregateDownvote } from "../../outputs/AggregateDownvote";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class AggregateDownvoteResolver {
@TypeGraphQL.Query(_returns => AggregateDownvote, {
nullable: false
})
async aggregateDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateDownvoteArgs): Promise<AggregateDownvote> {
return getPrismaFromContext(ctx).downvote.aggregate({
...args,
...transformInfoIntoPrismaArgs(info),
});
}
}
@@ -0,0 +1,20 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { CreateManyAndReturnDownvoteArgs } from "./args/CreateManyAndReturnDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { CreateManyAndReturnDownvote } from "../../outputs/CreateManyAndReturnDownvote";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class CreateManyAndReturnDownvoteResolver {
@TypeGraphQL.Mutation(_returns => [CreateManyAndReturnDownvote], {
nullable: false
})
async createManyAndReturnDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyAndReturnDownvoteArgs): Promise<CreateManyAndReturnDownvote[]> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.createManyAndReturn({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,20 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { CreateManyDownvoteArgs } from "./args/CreateManyDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class CreateManyDownvoteResolver {
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async createManyDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyDownvoteArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.createMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { CreateOneDownvoteArgs } from "./args/CreateOneDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class CreateOneDownvoteResolver {
@TypeGraphQL.Mutation(_returns => Downvote, {
nullable: false
})
async createOneDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateOneDownvoteArgs): Promise<Downvote> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.create({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,20 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { DeleteManyDownvoteArgs } from "./args/DeleteManyDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class DeleteManyDownvoteResolver {
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async deleteManyDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteManyDownvoteArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.deleteMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { DeleteOneDownvoteArgs } from "./args/DeleteOneDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class DeleteOneDownvoteResolver {
@TypeGraphQL.Mutation(_returns => Downvote, {
nullable: true
})
async deleteOneDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteOneDownvoteArgs): Promise<Downvote | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.delete({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,192 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { AggregateDownvoteArgs } from "./args/AggregateDownvoteArgs";
import { CreateManyAndReturnDownvoteArgs } from "./args/CreateManyAndReturnDownvoteArgs";
import { CreateManyDownvoteArgs } from "./args/CreateManyDownvoteArgs";
import { CreateOneDownvoteArgs } from "./args/CreateOneDownvoteArgs";
import { DeleteManyDownvoteArgs } from "./args/DeleteManyDownvoteArgs";
import { DeleteOneDownvoteArgs } from "./args/DeleteOneDownvoteArgs";
import { FindFirstDownvoteArgs } from "./args/FindFirstDownvoteArgs";
import { FindFirstDownvoteOrThrowArgs } from "./args/FindFirstDownvoteOrThrowArgs";
import { FindManyDownvoteArgs } from "./args/FindManyDownvoteArgs";
import { FindUniqueDownvoteArgs } from "./args/FindUniqueDownvoteArgs";
import { FindUniqueDownvoteOrThrowArgs } from "./args/FindUniqueDownvoteOrThrowArgs";
import { GroupByDownvoteArgs } from "./args/GroupByDownvoteArgs";
import { UpdateManyDownvoteArgs } from "./args/UpdateManyDownvoteArgs";
import { UpdateOneDownvoteArgs } from "./args/UpdateOneDownvoteArgs";
import { UpsertOneDownvoteArgs } from "./args/UpsertOneDownvoteArgs";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
import { Downvote } from "../../../models/Downvote";
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
import { AggregateDownvote } from "../../outputs/AggregateDownvote";
import { CreateManyAndReturnDownvote } from "../../outputs/CreateManyAndReturnDownvote";
import { DownvoteGroupBy } from "../../outputs/DownvoteGroupBy";
@TypeGraphQL.Resolver(_of => Downvote)
export class DownvoteCrudResolver {
@TypeGraphQL.Query(_returns => AggregateDownvote, {
nullable: false
})
async aggregateDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateDownvoteArgs): Promise<AggregateDownvote> {
return getPrismaFromContext(ctx).downvote.aggregate({
...args,
...transformInfoIntoPrismaArgs(info),
});
}
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async createManyDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyDownvoteArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.createMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => [CreateManyAndReturnDownvote], {
nullable: false
})
async createManyAndReturnDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyAndReturnDownvoteArgs): Promise<CreateManyAndReturnDownvote[]> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.createManyAndReturn({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => Downvote, {
nullable: false
})
async createOneDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateOneDownvoteArgs): Promise<Downvote> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.create({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async deleteManyDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteManyDownvoteArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.deleteMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => Downvote, {
nullable: true
})
async deleteOneDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteOneDownvoteArgs): Promise<Downvote | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.delete({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => Downvote, {
nullable: true
})
async findFirstDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstDownvoteArgs): Promise<Downvote | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.findFirst({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => Downvote, {
nullable: true
})
async findFirstDownvoteOrThrow(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstDownvoteOrThrowArgs): Promise<Downvote | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.findFirstOrThrow({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => [Downvote], {
nullable: false
})
async downvotes(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindManyDownvoteArgs): Promise<Downvote[]> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.findMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => Downvote, {
nullable: true
})
async downvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueDownvoteArgs): Promise<Downvote | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.findUnique({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => Downvote, {
nullable: true
})
async getDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueDownvoteOrThrowArgs): Promise<Downvote | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.findUniqueOrThrow({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => [DownvoteGroupBy], {
nullable: false
})
async groupByDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: GroupByDownvoteArgs): Promise<DownvoteGroupBy[]> {
const { _count, _avg, _sum, _min, _max } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.groupBy({
...args,
...Object.fromEntries(
Object.entries({ _count, _avg, _sum, _min, _max }).filter(([_, v]) => v != null)
),
});
}
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async updateManyDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateManyDownvoteArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.updateMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => Downvote, {
nullable: true
})
async updateOneDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateOneDownvoteArgs): Promise<Downvote | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.update({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => Downvote, {
nullable: false
})
async upsertOneDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpsertOneDownvoteArgs): Promise<Downvote> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.upsert({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindFirstDownvoteOrThrowArgs } from "./args/FindFirstDownvoteOrThrowArgs";
import { Downvote } from "../../../models/Downvote";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class FindFirstDownvoteOrThrowResolver {
@TypeGraphQL.Query(_returns => Downvote, {
nullable: true
})
async findFirstDownvoteOrThrow(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstDownvoteOrThrowArgs): Promise<Downvote | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.findFirstOrThrow({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindFirstDownvoteArgs } from "./args/FindFirstDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class FindFirstDownvoteResolver {
@TypeGraphQL.Query(_returns => Downvote, {
nullable: true
})
async findFirstDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstDownvoteArgs): Promise<Downvote | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.findFirst({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindManyDownvoteArgs } from "./args/FindManyDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class FindManyDownvoteResolver {
@TypeGraphQL.Query(_returns => [Downvote], {
nullable: false
})
async downvotes(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindManyDownvoteArgs): Promise<Downvote[]> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.findMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindUniqueDownvoteOrThrowArgs } from "./args/FindUniqueDownvoteOrThrowArgs";
import { Downvote } from "../../../models/Downvote";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class FindUniqueDownvoteOrThrowResolver {
@TypeGraphQL.Query(_returns => Downvote, {
nullable: true
})
async getDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueDownvoteOrThrowArgs): Promise<Downvote | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.findUniqueOrThrow({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindUniqueDownvoteArgs } from "./args/FindUniqueDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class FindUniqueDownvoteResolver {
@TypeGraphQL.Query(_returns => Downvote, {
nullable: true
})
async downvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueDownvoteArgs): Promise<Downvote | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.findUnique({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,22 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { GroupByDownvoteArgs } from "./args/GroupByDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { DownvoteGroupBy } from "../../outputs/DownvoteGroupBy";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class GroupByDownvoteResolver {
@TypeGraphQL.Query(_returns => [DownvoteGroupBy], {
nullable: false
})
async groupByDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: GroupByDownvoteArgs): Promise<DownvoteGroupBy[]> {
const { _count, _avg, _sum, _min, _max } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.groupBy({
...args,
...Object.fromEntries(
Object.entries({ _count, _avg, _sum, _min, _max }).filter(([_, v]) => v != null)
),
});
}
}
@@ -0,0 +1,20 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { UpdateManyDownvoteArgs } from "./args/UpdateManyDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class UpdateManyDownvoteResolver {
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async updateManyDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateManyDownvoteArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.updateMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { UpdateOneDownvoteArgs } from "./args/UpdateOneDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class UpdateOneDownvoteResolver {
@TypeGraphQL.Mutation(_returns => Downvote, {
nullable: true
})
async updateOneDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateOneDownvoteArgs): Promise<Downvote | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.update({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { UpsertOneDownvoteArgs } from "./args/UpsertOneDownvoteArgs";
import { Downvote } from "../../../models/Downvote";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Downvote)
export class UpsertOneDownvoteResolver {
@TypeGraphQL.Mutation(_returns => Downvote, {
nullable: false
})
async upsertOneDownvote(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpsertOneDownvoteArgs): Promise<Downvote> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).downvote.upsert({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,33 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteOrderByWithRelationInput } from "../../../inputs/DownvoteOrderByWithRelationInput";
import { DownvoteWhereInput } from "../../../inputs/DownvoteWhereInput";
import { DownvoteWhereUniqueInput } from "../../../inputs/DownvoteWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class AggregateDownvoteArgs {
@TypeGraphQL.Field(_type => DownvoteWhereInput, {
nullable: true
})
where?: DownvoteWhereInput | undefined;
@TypeGraphQL.Field(_type => [DownvoteOrderByWithRelationInput], {
nullable: true
})
orderBy?: DownvoteOrderByWithRelationInput[] | undefined;
@TypeGraphQL.Field(_type => DownvoteWhereUniqueInput, {
nullable: true
})
cursor?: DownvoteWhereUniqueInput | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
take?: number | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
skip?: number | undefined;
}
@@ -0,0 +1,16 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteCreateManyInput } from "../../../inputs/DownvoteCreateManyInput";
@TypeGraphQL.ArgsType()
export class CreateManyAndReturnDownvoteArgs {
@TypeGraphQL.Field(_type => [DownvoteCreateManyInput], {
nullable: false
})
data!: DownvoteCreateManyInput[];
@TypeGraphQL.Field(_type => Boolean, {
nullable: true
})
skipDuplicates?: boolean | undefined;
}
@@ -0,0 +1,16 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteCreateManyInput } from "../../../inputs/DownvoteCreateManyInput";
@TypeGraphQL.ArgsType()
export class CreateManyDownvoteArgs {
@TypeGraphQL.Field(_type => [DownvoteCreateManyInput], {
nullable: false
})
data!: DownvoteCreateManyInput[];
@TypeGraphQL.Field(_type => Boolean, {
nullable: true
})
skipDuplicates?: boolean | undefined;
}
@@ -0,0 +1,11 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteCreateInput } from "../../../inputs/DownvoteCreateInput";
@TypeGraphQL.ArgsType()
export class CreateOneDownvoteArgs {
@TypeGraphQL.Field(_type => DownvoteCreateInput, {
nullable: false
})
data!: DownvoteCreateInput;
}
@@ -0,0 +1,11 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteWhereInput } from "../../../inputs/DownvoteWhereInput";
@TypeGraphQL.ArgsType()
export class DeleteManyDownvoteArgs {
@TypeGraphQL.Field(_type => DownvoteWhereInput, {
nullable: true
})
where?: DownvoteWhereInput | undefined;
}
@@ -0,0 +1,11 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteWhereUniqueInput } from "../../../inputs/DownvoteWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class DeleteOneDownvoteArgs {
@TypeGraphQL.Field(_type => DownvoteWhereUniqueInput, {
nullable: false
})
where!: DownvoteWhereUniqueInput;
}
@@ -0,0 +1,39 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteOrderByWithRelationInput } from "../../../inputs/DownvoteOrderByWithRelationInput";
import { DownvoteWhereInput } from "../../../inputs/DownvoteWhereInput";
import { DownvoteWhereUniqueInput } from "../../../inputs/DownvoteWhereUniqueInput";
import { DownvoteScalarFieldEnum } from "../../../../enums/DownvoteScalarFieldEnum";
@TypeGraphQL.ArgsType()
export class FindFirstDownvoteArgs {
@TypeGraphQL.Field(_type => DownvoteWhereInput, {
nullable: true
})
where?: DownvoteWhereInput | undefined;
@TypeGraphQL.Field(_type => [DownvoteOrderByWithRelationInput], {
nullable: true
})
orderBy?: DownvoteOrderByWithRelationInput[] | undefined;
@TypeGraphQL.Field(_type => DownvoteWhereUniqueInput, {
nullable: true
})
cursor?: DownvoteWhereUniqueInput | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
take?: number | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
skip?: number | undefined;
@TypeGraphQL.Field(_type => [DownvoteScalarFieldEnum], {
nullable: true
})
distinct?: Array<"userID" | "postID"> | undefined;
}
@@ -0,0 +1,39 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteOrderByWithRelationInput } from "../../../inputs/DownvoteOrderByWithRelationInput";
import { DownvoteWhereInput } from "../../../inputs/DownvoteWhereInput";
import { DownvoteWhereUniqueInput } from "../../../inputs/DownvoteWhereUniqueInput";
import { DownvoteScalarFieldEnum } from "../../../../enums/DownvoteScalarFieldEnum";
@TypeGraphQL.ArgsType()
export class FindFirstDownvoteOrThrowArgs {
@TypeGraphQL.Field(_type => DownvoteWhereInput, {
nullable: true
})
where?: DownvoteWhereInput | undefined;
@TypeGraphQL.Field(_type => [DownvoteOrderByWithRelationInput], {
nullable: true
})
orderBy?: DownvoteOrderByWithRelationInput[] | undefined;
@TypeGraphQL.Field(_type => DownvoteWhereUniqueInput, {
nullable: true
})
cursor?: DownvoteWhereUniqueInput | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
take?: number | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
skip?: number | undefined;
@TypeGraphQL.Field(_type => [DownvoteScalarFieldEnum], {
nullable: true
})
distinct?: Array<"userID" | "postID"> | undefined;
}
@@ -0,0 +1,39 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteOrderByWithRelationInput } from "../../../inputs/DownvoteOrderByWithRelationInput";
import { DownvoteWhereInput } from "../../../inputs/DownvoteWhereInput";
import { DownvoteWhereUniqueInput } from "../../../inputs/DownvoteWhereUniqueInput";
import { DownvoteScalarFieldEnum } from "../../../../enums/DownvoteScalarFieldEnum";
@TypeGraphQL.ArgsType()
export class FindManyDownvoteArgs {
@TypeGraphQL.Field(_type => DownvoteWhereInput, {
nullable: true
})
where?: DownvoteWhereInput | undefined;
@TypeGraphQL.Field(_type => [DownvoteOrderByWithRelationInput], {
nullable: true
})
orderBy?: DownvoteOrderByWithRelationInput[] | undefined;
@TypeGraphQL.Field(_type => DownvoteWhereUniqueInput, {
nullable: true
})
cursor?: DownvoteWhereUniqueInput | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
take?: number | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
skip?: number | undefined;
@TypeGraphQL.Field(_type => [DownvoteScalarFieldEnum], {
nullable: true
})
distinct?: Array<"userID" | "postID"> | undefined;
}
@@ -0,0 +1,11 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteWhereUniqueInput } from "../../../inputs/DownvoteWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class FindUniqueDownvoteArgs {
@TypeGraphQL.Field(_type => DownvoteWhereUniqueInput, {
nullable: false
})
where!: DownvoteWhereUniqueInput;
}
@@ -0,0 +1,11 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteWhereUniqueInput } from "../../../inputs/DownvoteWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class FindUniqueDownvoteOrThrowArgs {
@TypeGraphQL.Field(_type => DownvoteWhereUniqueInput, {
nullable: false
})
where!: DownvoteWhereUniqueInput;
}
@@ -0,0 +1,39 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteOrderByWithAggregationInput } from "../../../inputs/DownvoteOrderByWithAggregationInput";
import { DownvoteScalarWhereWithAggregatesInput } from "../../../inputs/DownvoteScalarWhereWithAggregatesInput";
import { DownvoteWhereInput } from "../../../inputs/DownvoteWhereInput";
import { DownvoteScalarFieldEnum } from "../../../../enums/DownvoteScalarFieldEnum";
@TypeGraphQL.ArgsType()
export class GroupByDownvoteArgs {
@TypeGraphQL.Field(_type => DownvoteWhereInput, {
nullable: true
})
where?: DownvoteWhereInput | undefined;
@TypeGraphQL.Field(_type => [DownvoteOrderByWithAggregationInput], {
nullable: true
})
orderBy?: DownvoteOrderByWithAggregationInput[] | undefined;
@TypeGraphQL.Field(_type => [DownvoteScalarFieldEnum], {
nullable: false
})
by!: Array<"userID" | "postID">;
@TypeGraphQL.Field(_type => DownvoteScalarWhereWithAggregatesInput, {
nullable: true
})
having?: DownvoteScalarWhereWithAggregatesInput | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
take?: number | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
skip?: number | undefined;
}
@@ -0,0 +1,17 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteUpdateManyMutationInput } from "../../../inputs/DownvoteUpdateManyMutationInput";
import { DownvoteWhereInput } from "../../../inputs/DownvoteWhereInput";
@TypeGraphQL.ArgsType()
export class UpdateManyDownvoteArgs {
@TypeGraphQL.Field(_type => DownvoteUpdateManyMutationInput, {
nullable: false
})
data!: DownvoteUpdateManyMutationInput;
@TypeGraphQL.Field(_type => DownvoteWhereInput, {
nullable: true
})
where?: DownvoteWhereInput | undefined;
}
@@ -0,0 +1,17 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteUpdateInput } from "../../../inputs/DownvoteUpdateInput";
import { DownvoteWhereUniqueInput } from "../../../inputs/DownvoteWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class UpdateOneDownvoteArgs {
@TypeGraphQL.Field(_type => DownvoteUpdateInput, {
nullable: false
})
data!: DownvoteUpdateInput;
@TypeGraphQL.Field(_type => DownvoteWhereUniqueInput, {
nullable: false
})
where!: DownvoteWhereUniqueInput;
}
@@ -0,0 +1,23 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { DownvoteCreateInput } from "../../../inputs/DownvoteCreateInput";
import { DownvoteUpdateInput } from "../../../inputs/DownvoteUpdateInput";
import { DownvoteWhereUniqueInput } from "../../../inputs/DownvoteWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class UpsertOneDownvoteArgs {
@TypeGraphQL.Field(_type => DownvoteWhereUniqueInput, {
nullable: false
})
where!: DownvoteWhereUniqueInput;
@TypeGraphQL.Field(_type => DownvoteCreateInput, {
nullable: false
})
create!: DownvoteCreateInput;
@TypeGraphQL.Field(_type => DownvoteUpdateInput, {
nullable: false
})
update!: DownvoteUpdateInput;
}
@@ -0,0 +1,15 @@
export { AggregateDownvoteArgs } from "./AggregateDownvoteArgs";
export { CreateManyAndReturnDownvoteArgs } from "./CreateManyAndReturnDownvoteArgs";
export { CreateManyDownvoteArgs } from "./CreateManyDownvoteArgs";
export { CreateOneDownvoteArgs } from "./CreateOneDownvoteArgs";
export { DeleteManyDownvoteArgs } from "./DeleteManyDownvoteArgs";
export { DeleteOneDownvoteArgs } from "./DeleteOneDownvoteArgs";
export { FindFirstDownvoteArgs } from "./FindFirstDownvoteArgs";
export { FindFirstDownvoteOrThrowArgs } from "./FindFirstDownvoteOrThrowArgs";
export { FindManyDownvoteArgs } from "./FindManyDownvoteArgs";
export { FindUniqueDownvoteArgs } from "./FindUniqueDownvoteArgs";
export { FindUniqueDownvoteOrThrowArgs } from "./FindUniqueDownvoteOrThrowArgs";
export { GroupByDownvoteArgs } from "./GroupByDownvoteArgs";
export { UpdateManyDownvoteArgs } from "./UpdateManyDownvoteArgs";
export { UpdateOneDownvoteArgs } from "./UpdateOneDownvoteArgs";
export { UpsertOneDownvoteArgs } from "./UpsertOneDownvoteArgs";
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { AggregatePostArgs } from "./args/AggregatePostArgs";
import { Post } from "../../../models/Post";
import { AggregatePost } from "../../outputs/AggregatePost";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class AggregatePostResolver {
@TypeGraphQL.Query(_returns => AggregatePost, {
nullable: false
})
async aggregatePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregatePostArgs): Promise<AggregatePost> {
return getPrismaFromContext(ctx).post.aggregate({
...args,
...transformInfoIntoPrismaArgs(info),
});
}
}
@@ -0,0 +1,20 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { CreateManyAndReturnPostArgs } from "./args/CreateManyAndReturnPostArgs";
import { Post } from "../../../models/Post";
import { CreateManyAndReturnPost } from "../../outputs/CreateManyAndReturnPost";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class CreateManyAndReturnPostResolver {
@TypeGraphQL.Mutation(_returns => [CreateManyAndReturnPost], {
nullable: false
})
async createManyAndReturnPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyAndReturnPostArgs): Promise<CreateManyAndReturnPost[]> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.createManyAndReturn({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,20 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { CreateManyPostArgs } from "./args/CreateManyPostArgs";
import { Post } from "../../../models/Post";
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class CreateManyPostResolver {
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async createManyPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyPostArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.createMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { CreateOnePostArgs } from "./args/CreateOnePostArgs";
import { Post } from "../../../models/Post";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class CreateOnePostResolver {
@TypeGraphQL.Mutation(_returns => Post, {
nullable: false
})
async createOnePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateOnePostArgs): Promise<Post> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.create({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,20 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { DeleteManyPostArgs } from "./args/DeleteManyPostArgs";
import { Post } from "../../../models/Post";
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class DeleteManyPostResolver {
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async deleteManyPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteManyPostArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.deleteMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { DeleteOnePostArgs } from "./args/DeleteOnePostArgs";
import { Post } from "../../../models/Post";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class DeleteOnePostResolver {
@TypeGraphQL.Mutation(_returns => Post, {
nullable: true
})
async deleteOnePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteOnePostArgs): Promise<Post | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.delete({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindFirstPostOrThrowArgs } from "./args/FindFirstPostOrThrowArgs";
import { Post } from "../../../models/Post";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class FindFirstPostOrThrowResolver {
@TypeGraphQL.Query(_returns => Post, {
nullable: true
})
async findFirstPostOrThrow(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstPostOrThrowArgs): Promise<Post | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.findFirstOrThrow({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindFirstPostArgs } from "./args/FindFirstPostArgs";
import { Post } from "../../../models/Post";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class FindFirstPostResolver {
@TypeGraphQL.Query(_returns => Post, {
nullable: true
})
async findFirstPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstPostArgs): Promise<Post | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.findFirst({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindManyPostArgs } from "./args/FindManyPostArgs";
import { Post } from "../../../models/Post";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class FindManyPostResolver {
@TypeGraphQL.Query(_returns => [Post], {
nullable: false
})
async posts(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindManyPostArgs): Promise<Post[]> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.findMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindUniquePostOrThrowArgs } from "./args/FindUniquePostOrThrowArgs";
import { Post } from "../../../models/Post";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class FindUniquePostOrThrowResolver {
@TypeGraphQL.Query(_returns => Post, {
nullable: true
})
async getPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniquePostOrThrowArgs): Promise<Post | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.findUniqueOrThrow({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindUniquePostArgs } from "./args/FindUniquePostArgs";
import { Post } from "../../../models/Post";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class FindUniquePostResolver {
@TypeGraphQL.Query(_returns => Post, {
nullable: true
})
async post(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniquePostArgs): Promise<Post | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.findUnique({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,22 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { GroupByPostArgs } from "./args/GroupByPostArgs";
import { Post } from "../../../models/Post";
import { PostGroupBy } from "../../outputs/PostGroupBy";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class GroupByPostResolver {
@TypeGraphQL.Query(_returns => [PostGroupBy], {
nullable: false
})
async groupByPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: GroupByPostArgs): Promise<PostGroupBy[]> {
const { _count, _avg, _sum, _min, _max } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.groupBy({
...args,
...Object.fromEntries(
Object.entries({ _count, _avg, _sum, _min, _max }).filter(([_, v]) => v != null)
),
});
}
}
@@ -0,0 +1,192 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { AggregatePostArgs } from "./args/AggregatePostArgs";
import { CreateManyAndReturnPostArgs } from "./args/CreateManyAndReturnPostArgs";
import { CreateManyPostArgs } from "./args/CreateManyPostArgs";
import { CreateOnePostArgs } from "./args/CreateOnePostArgs";
import { DeleteManyPostArgs } from "./args/DeleteManyPostArgs";
import { DeleteOnePostArgs } from "./args/DeleteOnePostArgs";
import { FindFirstPostArgs } from "./args/FindFirstPostArgs";
import { FindFirstPostOrThrowArgs } from "./args/FindFirstPostOrThrowArgs";
import { FindManyPostArgs } from "./args/FindManyPostArgs";
import { FindUniquePostArgs } from "./args/FindUniquePostArgs";
import { FindUniquePostOrThrowArgs } from "./args/FindUniquePostOrThrowArgs";
import { GroupByPostArgs } from "./args/GroupByPostArgs";
import { UpdateManyPostArgs } from "./args/UpdateManyPostArgs";
import { UpdateOnePostArgs } from "./args/UpdateOnePostArgs";
import { UpsertOnePostArgs } from "./args/UpsertOnePostArgs";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
import { Post } from "../../../models/Post";
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
import { AggregatePost } from "../../outputs/AggregatePost";
import { CreateManyAndReturnPost } from "../../outputs/CreateManyAndReturnPost";
import { PostGroupBy } from "../../outputs/PostGroupBy";
@TypeGraphQL.Resolver(_of => Post)
export class PostCrudResolver {
@TypeGraphQL.Query(_returns => AggregatePost, {
nullable: false
})
async aggregatePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregatePostArgs): Promise<AggregatePost> {
return getPrismaFromContext(ctx).post.aggregate({
...args,
...transformInfoIntoPrismaArgs(info),
});
}
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async createManyPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyPostArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.createMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => [CreateManyAndReturnPost], {
nullable: false
})
async createManyAndReturnPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyAndReturnPostArgs): Promise<CreateManyAndReturnPost[]> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.createManyAndReturn({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => Post, {
nullable: false
})
async createOnePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateOnePostArgs): Promise<Post> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.create({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async deleteManyPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteManyPostArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.deleteMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => Post, {
nullable: true
})
async deleteOnePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteOnePostArgs): Promise<Post | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.delete({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => Post, {
nullable: true
})
async findFirstPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstPostArgs): Promise<Post | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.findFirst({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => Post, {
nullable: true
})
async findFirstPostOrThrow(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstPostOrThrowArgs): Promise<Post | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.findFirstOrThrow({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => [Post], {
nullable: false
})
async posts(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindManyPostArgs): Promise<Post[]> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.findMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => Post, {
nullable: true
})
async post(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniquePostArgs): Promise<Post | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.findUnique({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => Post, {
nullable: true
})
async getPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniquePostOrThrowArgs): Promise<Post | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.findUniqueOrThrow({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => [PostGroupBy], {
nullable: false
})
async groupByPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: GroupByPostArgs): Promise<PostGroupBy[]> {
const { _count, _avg, _sum, _min, _max } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.groupBy({
...args,
...Object.fromEntries(
Object.entries({ _count, _avg, _sum, _min, _max }).filter(([_, v]) => v != null)
),
});
}
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async updateManyPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateManyPostArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.updateMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => Post, {
nullable: true
})
async updateOnePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateOnePostArgs): Promise<Post | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.update({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => Post, {
nullable: false
})
async upsertOnePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpsertOnePostArgs): Promise<Post> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.upsert({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,20 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { UpdateManyPostArgs } from "./args/UpdateManyPostArgs";
import { Post } from "../../../models/Post";
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class UpdateManyPostResolver {
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async updateManyPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateManyPostArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.updateMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { UpdateOnePostArgs } from "./args/UpdateOnePostArgs";
import { Post } from "../../../models/Post";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class UpdateOnePostResolver {
@TypeGraphQL.Mutation(_returns => Post, {
nullable: true
})
async updateOnePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateOnePostArgs): Promise<Post | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.update({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { UpsertOnePostArgs } from "./args/UpsertOnePostArgs";
import { Post } from "../../../models/Post";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => Post)
export class UpsertOnePostResolver {
@TypeGraphQL.Mutation(_returns => Post, {
nullable: false
})
async upsertOnePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpsertOnePostArgs): Promise<Post> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).post.upsert({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,33 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostOrderByWithRelationInput } from "../../../inputs/PostOrderByWithRelationInput";
import { PostWhereInput } from "../../../inputs/PostWhereInput";
import { PostWhereUniqueInput } from "../../../inputs/PostWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class AggregatePostArgs {
@TypeGraphQL.Field(_type => PostWhereInput, {
nullable: true
})
where?: PostWhereInput | undefined;
@TypeGraphQL.Field(_type => [PostOrderByWithRelationInput], {
nullable: true
})
orderBy?: PostOrderByWithRelationInput[] | undefined;
@TypeGraphQL.Field(_type => PostWhereUniqueInput, {
nullable: true
})
cursor?: PostWhereUniqueInput | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
take?: number | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
skip?: number | undefined;
}
@@ -0,0 +1,16 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostCreateManyInput } from "../../../inputs/PostCreateManyInput";
@TypeGraphQL.ArgsType()
export class CreateManyAndReturnPostArgs {
@TypeGraphQL.Field(_type => [PostCreateManyInput], {
nullable: false
})
data!: PostCreateManyInput[];
@TypeGraphQL.Field(_type => Boolean, {
nullable: true
})
skipDuplicates?: boolean | undefined;
}
@@ -0,0 +1,16 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostCreateManyInput } from "../../../inputs/PostCreateManyInput";
@TypeGraphQL.ArgsType()
export class CreateManyPostArgs {
@TypeGraphQL.Field(_type => [PostCreateManyInput], {
nullable: false
})
data!: PostCreateManyInput[];
@TypeGraphQL.Field(_type => Boolean, {
nullable: true
})
skipDuplicates?: boolean | undefined;
}
@@ -0,0 +1,11 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostCreateInput } from "../../../inputs/PostCreateInput";
@TypeGraphQL.ArgsType()
export class CreateOnePostArgs {
@TypeGraphQL.Field(_type => PostCreateInput, {
nullable: false
})
data!: PostCreateInput;
}
@@ -0,0 +1,11 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostWhereInput } from "../../../inputs/PostWhereInput";
@TypeGraphQL.ArgsType()
export class DeleteManyPostArgs {
@TypeGraphQL.Field(_type => PostWhereInput, {
nullable: true
})
where?: PostWhereInput | undefined;
}
@@ -0,0 +1,11 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostWhereUniqueInput } from "../../../inputs/PostWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class DeleteOnePostArgs {
@TypeGraphQL.Field(_type => PostWhereUniqueInput, {
nullable: false
})
where!: PostWhereUniqueInput;
}
@@ -0,0 +1,39 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostOrderByWithRelationInput } from "../../../inputs/PostOrderByWithRelationInput";
import { PostWhereInput } from "../../../inputs/PostWhereInput";
import { PostWhereUniqueInput } from "../../../inputs/PostWhereUniqueInput";
import { PostScalarFieldEnum } from "../../../../enums/PostScalarFieldEnum";
@TypeGraphQL.ArgsType()
export class FindFirstPostArgs {
@TypeGraphQL.Field(_type => PostWhereInput, {
nullable: true
})
where?: PostWhereInput | undefined;
@TypeGraphQL.Field(_type => [PostOrderByWithRelationInput], {
nullable: true
})
orderBy?: PostOrderByWithRelationInput[] | undefined;
@TypeGraphQL.Field(_type => PostWhereUniqueInput, {
nullable: true
})
cursor?: PostWhereUniqueInput | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
take?: number | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
skip?: number | undefined;
@TypeGraphQL.Field(_type => [PostScalarFieldEnum], {
nullable: true
})
distinct?: Array<"id" | "createdAt" | "updatedAt" | "title" | "content" | "authorID" | "points"> | undefined;
}
@@ -0,0 +1,39 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostOrderByWithRelationInput } from "../../../inputs/PostOrderByWithRelationInput";
import { PostWhereInput } from "../../../inputs/PostWhereInput";
import { PostWhereUniqueInput } from "../../../inputs/PostWhereUniqueInput";
import { PostScalarFieldEnum } from "../../../../enums/PostScalarFieldEnum";
@TypeGraphQL.ArgsType()
export class FindFirstPostOrThrowArgs {
@TypeGraphQL.Field(_type => PostWhereInput, {
nullable: true
})
where?: PostWhereInput | undefined;
@TypeGraphQL.Field(_type => [PostOrderByWithRelationInput], {
nullable: true
})
orderBy?: PostOrderByWithRelationInput[] | undefined;
@TypeGraphQL.Field(_type => PostWhereUniqueInput, {
nullable: true
})
cursor?: PostWhereUniqueInput | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
take?: number | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
skip?: number | undefined;
@TypeGraphQL.Field(_type => [PostScalarFieldEnum], {
nullable: true
})
distinct?: Array<"id" | "createdAt" | "updatedAt" | "title" | "content" | "authorID" | "points"> | undefined;
}
@@ -0,0 +1,39 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostOrderByWithRelationInput } from "../../../inputs/PostOrderByWithRelationInput";
import { PostWhereInput } from "../../../inputs/PostWhereInput";
import { PostWhereUniqueInput } from "../../../inputs/PostWhereUniqueInput";
import { PostScalarFieldEnum } from "../../../../enums/PostScalarFieldEnum";
@TypeGraphQL.ArgsType()
export class FindManyPostArgs {
@TypeGraphQL.Field(_type => PostWhereInput, {
nullable: true
})
where?: PostWhereInput | undefined;
@TypeGraphQL.Field(_type => [PostOrderByWithRelationInput], {
nullable: true
})
orderBy?: PostOrderByWithRelationInput[] | undefined;
@TypeGraphQL.Field(_type => PostWhereUniqueInput, {
nullable: true
})
cursor?: PostWhereUniqueInput | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
take?: number | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
skip?: number | undefined;
@TypeGraphQL.Field(_type => [PostScalarFieldEnum], {
nullable: true
})
distinct?: Array<"id" | "createdAt" | "updatedAt" | "title" | "content" | "authorID" | "points"> | undefined;
}
@@ -0,0 +1,11 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostWhereUniqueInput } from "../../../inputs/PostWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class FindUniquePostArgs {
@TypeGraphQL.Field(_type => PostWhereUniqueInput, {
nullable: false
})
where!: PostWhereUniqueInput;
}
@@ -0,0 +1,11 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostWhereUniqueInput } from "../../../inputs/PostWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class FindUniquePostOrThrowArgs {
@TypeGraphQL.Field(_type => PostWhereUniqueInput, {
nullable: false
})
where!: PostWhereUniqueInput;
}
@@ -0,0 +1,39 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostOrderByWithAggregationInput } from "../../../inputs/PostOrderByWithAggregationInput";
import { PostScalarWhereWithAggregatesInput } from "../../../inputs/PostScalarWhereWithAggregatesInput";
import { PostWhereInput } from "../../../inputs/PostWhereInput";
import { PostScalarFieldEnum } from "../../../../enums/PostScalarFieldEnum";
@TypeGraphQL.ArgsType()
export class GroupByPostArgs {
@TypeGraphQL.Field(_type => PostWhereInput, {
nullable: true
})
where?: PostWhereInput | undefined;
@TypeGraphQL.Field(_type => [PostOrderByWithAggregationInput], {
nullable: true
})
orderBy?: PostOrderByWithAggregationInput[] | undefined;
@TypeGraphQL.Field(_type => [PostScalarFieldEnum], {
nullable: false
})
by!: Array<"id" | "createdAt" | "updatedAt" | "title" | "content" | "authorID" | "points">;
@TypeGraphQL.Field(_type => PostScalarWhereWithAggregatesInput, {
nullable: true
})
having?: PostScalarWhereWithAggregatesInput | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
take?: number | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
skip?: number | undefined;
}
@@ -0,0 +1,17 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostUpdateManyMutationInput } from "../../../inputs/PostUpdateManyMutationInput";
import { PostWhereInput } from "../../../inputs/PostWhereInput";
@TypeGraphQL.ArgsType()
export class UpdateManyPostArgs {
@TypeGraphQL.Field(_type => PostUpdateManyMutationInput, {
nullable: false
})
data!: PostUpdateManyMutationInput;
@TypeGraphQL.Field(_type => PostWhereInput, {
nullable: true
})
where?: PostWhereInput | undefined;
}
@@ -0,0 +1,17 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostUpdateInput } from "../../../inputs/PostUpdateInput";
import { PostWhereUniqueInput } from "../../../inputs/PostWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class UpdateOnePostArgs {
@TypeGraphQL.Field(_type => PostUpdateInput, {
nullable: false
})
data!: PostUpdateInput;
@TypeGraphQL.Field(_type => PostWhereUniqueInput, {
nullable: false
})
where!: PostWhereUniqueInput;
}
@@ -0,0 +1,23 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { PostCreateInput } from "../../../inputs/PostCreateInput";
import { PostUpdateInput } from "../../../inputs/PostUpdateInput";
import { PostWhereUniqueInput } from "../../../inputs/PostWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class UpsertOnePostArgs {
@TypeGraphQL.Field(_type => PostWhereUniqueInput, {
nullable: false
})
where!: PostWhereUniqueInput;
@TypeGraphQL.Field(_type => PostCreateInput, {
nullable: false
})
create!: PostCreateInput;
@TypeGraphQL.Field(_type => PostUpdateInput, {
nullable: false
})
update!: PostUpdateInput;
}
@@ -0,0 +1,15 @@
export { AggregatePostArgs } from "./AggregatePostArgs";
export { CreateManyAndReturnPostArgs } from "./CreateManyAndReturnPostArgs";
export { CreateManyPostArgs } from "./CreateManyPostArgs";
export { CreateOnePostArgs } from "./CreateOnePostArgs";
export { DeleteManyPostArgs } from "./DeleteManyPostArgs";
export { DeleteOnePostArgs } from "./DeleteOnePostArgs";
export { FindFirstPostArgs } from "./FindFirstPostArgs";
export { FindFirstPostOrThrowArgs } from "./FindFirstPostOrThrowArgs";
export { FindManyPostArgs } from "./FindManyPostArgs";
export { FindUniquePostArgs } from "./FindUniquePostArgs";
export { FindUniquePostOrThrowArgs } from "./FindUniquePostOrThrowArgs";
export { GroupByPostArgs } from "./GroupByPostArgs";
export { UpdateManyPostArgs } from "./UpdateManyPostArgs";
export { UpdateOnePostArgs } from "./UpdateOnePostArgs";
export { UpsertOnePostArgs } from "./UpsertOnePostArgs";
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { AggregateResetPasswordTokenArgs } from "./args/AggregateResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { AggregateResetPasswordToken } from "../../outputs/AggregateResetPasswordToken";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class AggregateResetPasswordTokenResolver {
@TypeGraphQL.Query(_returns => AggregateResetPasswordToken, {
nullable: false
})
async aggregateResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateResetPasswordTokenArgs): Promise<AggregateResetPasswordToken> {
return getPrismaFromContext(ctx).resetPasswordToken.aggregate({
...args,
...transformInfoIntoPrismaArgs(info),
});
}
}
@@ -0,0 +1,20 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { CreateManyAndReturnResetPasswordTokenArgs } from "./args/CreateManyAndReturnResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { CreateManyAndReturnResetPasswordToken } from "../../outputs/CreateManyAndReturnResetPasswordToken";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class CreateManyAndReturnResetPasswordTokenResolver {
@TypeGraphQL.Mutation(_returns => [CreateManyAndReturnResetPasswordToken], {
nullable: false
})
async createManyAndReturnResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyAndReturnResetPasswordTokenArgs): Promise<CreateManyAndReturnResetPasswordToken[]> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.createManyAndReturn({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,20 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { CreateManyResetPasswordTokenArgs } from "./args/CreateManyResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class CreateManyResetPasswordTokenResolver {
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async createManyResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyResetPasswordTokenArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.createMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { CreateOneResetPasswordTokenArgs } from "./args/CreateOneResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class CreateOneResetPasswordTokenResolver {
@TypeGraphQL.Mutation(_returns => ResetPasswordToken, {
nullable: false
})
async createOneResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateOneResetPasswordTokenArgs): Promise<ResetPasswordToken> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.create({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,20 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { DeleteManyResetPasswordTokenArgs } from "./args/DeleteManyResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class DeleteManyResetPasswordTokenResolver {
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async deleteManyResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteManyResetPasswordTokenArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.deleteMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { DeleteOneResetPasswordTokenArgs } from "./args/DeleteOneResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class DeleteOneResetPasswordTokenResolver {
@TypeGraphQL.Mutation(_returns => ResetPasswordToken, {
nullable: true
})
async deleteOneResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteOneResetPasswordTokenArgs): Promise<ResetPasswordToken | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.delete({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindFirstResetPasswordTokenOrThrowArgs } from "./args/FindFirstResetPasswordTokenOrThrowArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class FindFirstResetPasswordTokenOrThrowResolver {
@TypeGraphQL.Query(_returns => ResetPasswordToken, {
nullable: true
})
async findFirstResetPasswordTokenOrThrow(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstResetPasswordTokenOrThrowArgs): Promise<ResetPasswordToken | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.findFirstOrThrow({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindFirstResetPasswordTokenArgs } from "./args/FindFirstResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class FindFirstResetPasswordTokenResolver {
@TypeGraphQL.Query(_returns => ResetPasswordToken, {
nullable: true
})
async findFirstResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstResetPasswordTokenArgs): Promise<ResetPasswordToken | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.findFirst({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindManyResetPasswordTokenArgs } from "./args/FindManyResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class FindManyResetPasswordTokenResolver {
@TypeGraphQL.Query(_returns => [ResetPasswordToken], {
nullable: false
})
async resetPasswordTokens(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindManyResetPasswordTokenArgs): Promise<ResetPasswordToken[]> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.findMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindUniqueResetPasswordTokenOrThrowArgs } from "./args/FindUniqueResetPasswordTokenOrThrowArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class FindUniqueResetPasswordTokenOrThrowResolver {
@TypeGraphQL.Query(_returns => ResetPasswordToken, {
nullable: true
})
async getResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueResetPasswordTokenOrThrowArgs): Promise<ResetPasswordToken | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.findUniqueOrThrow({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { FindUniqueResetPasswordTokenArgs } from "./args/FindUniqueResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class FindUniqueResetPasswordTokenResolver {
@TypeGraphQL.Query(_returns => ResetPasswordToken, {
nullable: true
})
async resetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueResetPasswordTokenArgs): Promise<ResetPasswordToken | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.findUnique({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,22 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { GroupByResetPasswordTokenArgs } from "./args/GroupByResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { ResetPasswordTokenGroupBy } from "../../outputs/ResetPasswordTokenGroupBy";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class GroupByResetPasswordTokenResolver {
@TypeGraphQL.Query(_returns => [ResetPasswordTokenGroupBy], {
nullable: false
})
async groupByResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: GroupByResetPasswordTokenArgs): Promise<ResetPasswordTokenGroupBy[]> {
const { _count, _avg, _sum, _min, _max } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.groupBy({
...args,
...Object.fromEntries(
Object.entries({ _count, _avg, _sum, _min, _max }).filter(([_, v]) => v != null)
),
});
}
}
@@ -0,0 +1,192 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { AggregateResetPasswordTokenArgs } from "./args/AggregateResetPasswordTokenArgs";
import { CreateManyAndReturnResetPasswordTokenArgs } from "./args/CreateManyAndReturnResetPasswordTokenArgs";
import { CreateManyResetPasswordTokenArgs } from "./args/CreateManyResetPasswordTokenArgs";
import { CreateOneResetPasswordTokenArgs } from "./args/CreateOneResetPasswordTokenArgs";
import { DeleteManyResetPasswordTokenArgs } from "./args/DeleteManyResetPasswordTokenArgs";
import { DeleteOneResetPasswordTokenArgs } from "./args/DeleteOneResetPasswordTokenArgs";
import { FindFirstResetPasswordTokenArgs } from "./args/FindFirstResetPasswordTokenArgs";
import { FindFirstResetPasswordTokenOrThrowArgs } from "./args/FindFirstResetPasswordTokenOrThrowArgs";
import { FindManyResetPasswordTokenArgs } from "./args/FindManyResetPasswordTokenArgs";
import { FindUniqueResetPasswordTokenArgs } from "./args/FindUniqueResetPasswordTokenArgs";
import { FindUniqueResetPasswordTokenOrThrowArgs } from "./args/FindUniqueResetPasswordTokenOrThrowArgs";
import { GroupByResetPasswordTokenArgs } from "./args/GroupByResetPasswordTokenArgs";
import { UpdateManyResetPasswordTokenArgs } from "./args/UpdateManyResetPasswordTokenArgs";
import { UpdateOneResetPasswordTokenArgs } from "./args/UpdateOneResetPasswordTokenArgs";
import { UpsertOneResetPasswordTokenArgs } from "./args/UpsertOneResetPasswordTokenArgs";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
import { AggregateResetPasswordToken } from "../../outputs/AggregateResetPasswordToken";
import { CreateManyAndReturnResetPasswordToken } from "../../outputs/CreateManyAndReturnResetPasswordToken";
import { ResetPasswordTokenGroupBy } from "../../outputs/ResetPasswordTokenGroupBy";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class ResetPasswordTokenCrudResolver {
@TypeGraphQL.Query(_returns => AggregateResetPasswordToken, {
nullable: false
})
async aggregateResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateResetPasswordTokenArgs): Promise<AggregateResetPasswordToken> {
return getPrismaFromContext(ctx).resetPasswordToken.aggregate({
...args,
...transformInfoIntoPrismaArgs(info),
});
}
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async createManyResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyResetPasswordTokenArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.createMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => [CreateManyAndReturnResetPasswordToken], {
nullable: false
})
async createManyAndReturnResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyAndReturnResetPasswordTokenArgs): Promise<CreateManyAndReturnResetPasswordToken[]> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.createManyAndReturn({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => ResetPasswordToken, {
nullable: false
})
async createOneResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateOneResetPasswordTokenArgs): Promise<ResetPasswordToken> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.create({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async deleteManyResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteManyResetPasswordTokenArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.deleteMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => ResetPasswordToken, {
nullable: true
})
async deleteOneResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: DeleteOneResetPasswordTokenArgs): Promise<ResetPasswordToken | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.delete({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => ResetPasswordToken, {
nullable: true
})
async findFirstResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstResetPasswordTokenArgs): Promise<ResetPasswordToken | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.findFirst({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => ResetPasswordToken, {
nullable: true
})
async findFirstResetPasswordTokenOrThrow(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstResetPasswordTokenOrThrowArgs): Promise<ResetPasswordToken | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.findFirstOrThrow({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => [ResetPasswordToken], {
nullable: false
})
async resetPasswordTokens(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindManyResetPasswordTokenArgs): Promise<ResetPasswordToken[]> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.findMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => ResetPasswordToken, {
nullable: true
})
async resetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueResetPasswordTokenArgs): Promise<ResetPasswordToken | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.findUnique({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => ResetPasswordToken, {
nullable: true
})
async getResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueResetPasswordTokenOrThrowArgs): Promise<ResetPasswordToken | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.findUniqueOrThrow({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Query(_returns => [ResetPasswordTokenGroupBy], {
nullable: false
})
async groupByResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: GroupByResetPasswordTokenArgs): Promise<ResetPasswordTokenGroupBy[]> {
const { _count, _avg, _sum, _min, _max } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.groupBy({
...args,
...Object.fromEntries(
Object.entries({ _count, _avg, _sum, _min, _max }).filter(([_, v]) => v != null)
),
});
}
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async updateManyResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateManyResetPasswordTokenArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.updateMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => ResetPasswordToken, {
nullable: true
})
async updateOneResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateOneResetPasswordTokenArgs): Promise<ResetPasswordToken | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.update({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
@TypeGraphQL.Mutation(_returns => ResetPasswordToken, {
nullable: false
})
async upsertOneResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpsertOneResetPasswordTokenArgs): Promise<ResetPasswordToken> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.upsert({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,20 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { UpdateManyResetPasswordTokenArgs } from "./args/UpdateManyResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class UpdateManyResetPasswordTokenResolver {
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
nullable: false
})
async updateManyResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateManyResetPasswordTokenArgs): Promise<AffectedRowsOutput> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.updateMany({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { UpdateOneResetPasswordTokenArgs } from "./args/UpdateOneResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class UpdateOneResetPasswordTokenResolver {
@TypeGraphQL.Mutation(_returns => ResetPasswordToken, {
nullable: true
})
async updateOneResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpdateOneResetPasswordTokenArgs): Promise<ResetPasswordToken | null> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.update({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,19 @@
import * as TypeGraphQL from "type-graphql";
import type { GraphQLResolveInfo } from "graphql";
import { UpsertOneResetPasswordTokenArgs } from "./args/UpsertOneResetPasswordTokenArgs";
import { ResetPasswordToken } from "../../../models/ResetPasswordToken";
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
@TypeGraphQL.Resolver(_of => ResetPasswordToken)
export class UpsertOneResetPasswordTokenResolver {
@TypeGraphQL.Mutation(_returns => ResetPasswordToken, {
nullable: false
})
async upsertOneResetPasswordToken(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: UpsertOneResetPasswordTokenArgs): Promise<ResetPasswordToken> {
const { _count } = transformInfoIntoPrismaArgs(info);
return getPrismaFromContext(ctx).resetPasswordToken.upsert({
...args,
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
});
}
}
@@ -0,0 +1,33 @@
import * as TypeGraphQL from "type-graphql";
import * as GraphQLScalars from "graphql-scalars";
import { ResetPasswordTokenOrderByWithRelationInput } from "../../../inputs/ResetPasswordTokenOrderByWithRelationInput";
import { ResetPasswordTokenWhereInput } from "../../../inputs/ResetPasswordTokenWhereInput";
import { ResetPasswordTokenWhereUniqueInput } from "../../../inputs/ResetPasswordTokenWhereUniqueInput";
@TypeGraphQL.ArgsType()
export class AggregateResetPasswordTokenArgs {
@TypeGraphQL.Field(_type => ResetPasswordTokenWhereInput, {
nullable: true
})
where?: ResetPasswordTokenWhereInput | undefined;
@TypeGraphQL.Field(_type => [ResetPasswordTokenOrderByWithRelationInput], {
nullable: true
})
orderBy?: ResetPasswordTokenOrderByWithRelationInput[] | undefined;
@TypeGraphQL.Field(_type => ResetPasswordTokenWhereUniqueInput, {
nullable: true
})
cursor?: ResetPasswordTokenWhereUniqueInput | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
take?: number | undefined;
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
nullable: true
})
skip?: number | undefined;
}

Some files were not shown because too many files have changed in this diff Show More