no mandatory parameters in updateUserInfos

This commit is contained in:
Claus-Peter Huebner 2024-02-12 20:07:46 +01:00
parent 4ba4a239f2
commit 0c1f6cde70
4 changed files with 33 additions and 12 deletions

View File

@ -44,19 +44,19 @@ export class UpdateUserInfosArgs {
@IsBoolean()
hideAmountGDT?: boolean
@Field({ nullable: false })
@Field({ nullable: true, defaultValue: true })
@IsBoolean()
gmsAllowed: boolean
gmsAllowed?: boolean
@Field(() => Int, { nullable: false })
@Field(() => Int, { nullable: true, defaultValue: 0 })
@IsInt()
gmsPublishName: number
gmsPublishName?: number | null
@Field(() => Location, { nullable: true })
@isValidLocation()
gmsLocation?: Location | null
@Field(() => Int, { nullable: false })
@Field(() => Int, { nullable: true, defaultValue: 2 })
@IsInt()
gmsPublishLocation: number
gmsPublishLocation?: number | null
}

View File

@ -19,6 +19,8 @@ import { SearchUsersFilters } from '@arg/SearchUsersFilters'
import { SetUserRoleArgs } from '@arg/SetUserRoleArgs'
import { UnsecureLoginArgs } from '@arg/UnsecureLoginArgs'
import { UpdateUserInfosArgs } from '@arg/UpdateUserInfosArgs'
import { GmsPublishLocationType } from '@enum/GmsPublishLocationType'
import { GmsPublishNameType } from '@enum/GmsPublishNameType'
import { OptInType } from '@enum/OptInType'
import { Order } from '@enum/Order'
import { PasswordEncryptionType } from '@enum/PasswordEncryptionType'
@ -559,6 +561,17 @@ export class UserResolver {
logger.info(
`updateUserInfos(${firstName}, ${lastName}, ${alias}, ${language}, ***, ***, ${hideAmountGDD}, ${hideAmountGDT}, ${gmsAllowed}, ${gmsPublishName}, ${gmsLocation}, ${gmsPublishLocation})...`,
)
// check default arg settings
if (gmsAllowed === null || gmsAllowed === undefined) {
gmsAllowed = true
}
if (!gmsPublishName) {
gmsPublishName = GmsPublishNameType.GMS_PUBLISH_NAME_ALIAS_OR_INITALS
}
if (!gmsPublishLocation) {
gmsPublishLocation = GmsPublishLocationType.GMS_LOCATION_TYPE_RANDOM
}
const user = getUser(context)
// try {
if (firstName) {

View File

@ -34,10 +34,10 @@ export const updateUserInfos = gql`
$locale: String
$hideAmountGDD: Boolean
$hideAmountGDT: Boolean
$gmsAllowed: Boolean!
$gmsPublishName: Int!
$gmsAllowed: Boolean
$gmsPublishName: Int
$gmsLocation: Location
$gmsPublishLocation: Int!
$gmsPublishLocation: Int
) {
updateUserInfos(
firstName: $firstName

View File

@ -25,25 +25,33 @@ export const forgotPassword = gql`
`
export const updateUserInfos = gql`
mutation(
$alias: String
mutation (
$firstName: String
$lastName: String
$alias: String
$password: String
$passwordNew: String
$locale: String
$hideAmountGDD: Boolean
$hideAmountGDT: Boolean
$gmsAllowed: Boolean
$gmsPublishName: Int
$gmsLocation: Location
$gmsPublishLocation: Int
) {
updateUserInfos(
alias: $alias
firstName: $firstName
lastName: $lastName
alias: $alias
password: $password
passwordNew: $passwordNew
language: $locale
hideAmountGDD: $hideAmountGDD
hideAmountGDT: $hideAmountGDT
gmsAllowed: $gmsAllowed
gmsPublishName: $gmsPublishName
gmsLocation: $gmsLocation
gmsPublishLocation: $gmsPublishLocation
)
}
`