mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
define Int as type for args of Ids
This commit is contained in:
parent
6124e0764f
commit
4c396d7581
@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
import { Resolver, Query, Arg, Args, Authorized, Mutation, Ctx } from 'type-graphql'
|
import { Resolver, Query, Arg, Args, Authorized, Mutation, Ctx, Int } from 'type-graphql'
|
||||||
import {
|
import {
|
||||||
getCustomRepository,
|
getCustomRepository,
|
||||||
IsNull,
|
IsNull,
|
||||||
@ -122,7 +122,10 @@ export class AdminResolver {
|
|||||||
|
|
||||||
@Authorized([RIGHTS.DELETE_USER])
|
@Authorized([RIGHTS.DELETE_USER])
|
||||||
@Mutation(() => Date, { nullable: true })
|
@Mutation(() => Date, { nullable: true })
|
||||||
async deleteUser(@Arg('userId') userId: number, @Ctx() context: any): Promise<Date | null> {
|
async deleteUser(
|
||||||
|
@Arg('userId', () => Int) userId: number,
|
||||||
|
@Ctx() context: any,
|
||||||
|
): Promise<Date | null> {
|
||||||
const user = await User.findOne({ id: userId })
|
const user = await User.findOne({ id: userId })
|
||||||
// user exists ?
|
// user exists ?
|
||||||
if (!user) {
|
if (!user) {
|
||||||
@ -142,7 +145,7 @@ export class AdminResolver {
|
|||||||
|
|
||||||
@Authorized([RIGHTS.UNDELETE_USER])
|
@Authorized([RIGHTS.UNDELETE_USER])
|
||||||
@Mutation(() => Date, { nullable: true })
|
@Mutation(() => Date, { nullable: true })
|
||||||
async unDeleteUser(@Arg('userId') userId: number): Promise<Date | null> {
|
async unDeleteUser(@Arg('userId', () => Int) userId: number): Promise<Date | null> {
|
||||||
const user = await User.findOne({ id: userId }, { withDeleted: true })
|
const user = await User.findOne({ id: userId }, { withDeleted: true })
|
||||||
// user exists ?
|
// user exists ?
|
||||||
if (!user) {
|
if (!user) {
|
||||||
@ -284,7 +287,7 @@ export class AdminResolver {
|
|||||||
|
|
||||||
@Authorized([RIGHTS.DELETE_PENDING_CREATION])
|
@Authorized([RIGHTS.DELETE_PENDING_CREATION])
|
||||||
@Mutation(() => Boolean)
|
@Mutation(() => Boolean)
|
||||||
async deletePendingCreation(@Arg('id') id: number): Promise<boolean> {
|
async deletePendingCreation(@Arg('id', () => Int) id: number): Promise<boolean> {
|
||||||
const entity = await AdminPendingCreation.findOneOrFail(id)
|
const entity = await AdminPendingCreation.findOneOrFail(id)
|
||||||
const res = await AdminPendingCreation.delete(entity)
|
const res = await AdminPendingCreation.delete(entity)
|
||||||
return !!res
|
return !!res
|
||||||
@ -292,7 +295,10 @@ export class AdminResolver {
|
|||||||
|
|
||||||
@Authorized([RIGHTS.CONFIRM_PENDING_CREATION])
|
@Authorized([RIGHTS.CONFIRM_PENDING_CREATION])
|
||||||
@Mutation(() => Boolean)
|
@Mutation(() => Boolean)
|
||||||
async confirmPendingCreation(@Arg('id') id: number, @Ctx() context: any): Promise<boolean> {
|
async confirmPendingCreation(
|
||||||
|
@Arg('id', () => Int) id: number,
|
||||||
|
@Ctx() context: any,
|
||||||
|
): Promise<boolean> {
|
||||||
const pendingCreation = await AdminPendingCreation.findOneOrFail(id)
|
const pendingCreation = await AdminPendingCreation.findOneOrFail(id)
|
||||||
const userRepository = getCustomRepository(UserRepository)
|
const userRepository = getCustomRepository(UserRepository)
|
||||||
const moderatorUser = await userRepository.findByPubkeyHex(context.pubKey)
|
const moderatorUser = await userRepository.findByPubkeyHex(context.pubKey)
|
||||||
|
|||||||
@ -39,7 +39,6 @@ const apolloLogPlugin = ApolloLogPlugin({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const plugins =
|
const plugins = process.env.NODE_ENV === 'development' ? [setHeadersPlugin] : [setHeadersPlugin] // , apolloLogPlugin
|
||||||
process.env.NODE_ENV === 'development' ? [setHeadersPlugin] : [setHeadersPlugin, apolloLogPlugin]
|
|
||||||
|
|
||||||
export default plugins
|
export default plugins
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user