feat: check action data 3
This commit is contained in:
1 parent
985629995c
commit
b5fba09f0d
12 files changed
+151
-78
No files matched your search
@@ -2,16 +2,23 @@ import BaseAction from '../BaseAction';
|
||||
import { getGroupMember } from '@/core/data';
|
||||
import { ActionName } from '../types';
|
||||
import { NTQQGroupApi } from '@/core/apis/group';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
interface Payload {
|
||||
group_id: number,
|
||||
user_id: number,
|
||||
card: string
|
||||
}
|
||||
const SchemaData = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
group_id: { type: 'number' },
|
||||
user_id: { type: 'number' },
|
||||
card: { type: 'string' }
|
||||
},
|
||||
required: ['group_id', 'user_id', 'card']
|
||||
} as const satisfies JSONSchema;
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class SetGroupCard extends BaseAction<Payload, null> {
|
||||
actionName = ActionName.SetGroupCard;
|
||||
|
||||
PayloadSchema = SchemaData;
|
||||
protected async _handle(payload: Payload): Promise<null> {
|
||||
const member = await getGroupMember(payload.group_id, payload.user_id);
|
||||
if (!member) {
|
||||
|
||||
Reference in new issue
Block a user