server: improve API validation for creating apps
All checks were successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/test Pipeline was successful

Resolves a FIXME comment.
This commit is contained in:
Johann150 2022-11-05 10:43:34 +01:00
parent 6f65326b32
commit 489eea0c67
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -2,6 +2,7 @@ import { Apps } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import { unique } from '@/prelude/array.js';
import { secureRndstr } from '@/misc/secure-rndstr.js';
import { kinds } from '@/misc/api-permissions.js';
import define from '../../define.js';
export const meta = {
@ -21,10 +22,14 @@ export const paramDef = {
properties: {
name: { type: 'string' },
description: { type: 'string' },
permission: { type: 'array', uniqueItems: true, items: {
type: 'string',
// FIXME: add enum of possible permissions
} },
permission: {
type: 'array',
uniqueItems: true,
items: {
type: 'string',
enum: kinds,
},
},
callbackUrl: { type: 'string', nullable: true },
},
required: ['name', 'description', 'permission'],