feat: check action data 2

This commit is contained in:
手瓜一十雪 committed 2024-05-18 12:23:15 +08:00
1 parent d4e5201913
commit 62eee5f05c
6 files changed
+73 -43

No files matched your search

@@ -7,21 +7,27 @@ import { dbUtil } from '@/core/utils/db';
import { NTQQMsgApi } from '@/core/apis/msg';
import { OB11Constructor } from '../../constructor';
import { logDebug } from '@/common/utils/log';
interface Payload {
user_id: number
message_seq: number,
count: number
}
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
interface Response {
messages: OB11Message[];
messages: OB11Message[];
}
const SchemaData = {
type: 'object',
properties: {
user_id: { type: 'number' },
message_seq: { type: 'number' },
count: { type: 'number' }
},
required: ['user_id', 'message_seq', 'count']
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
export default class GetFriendMsgHistory extends BaseAction<Payload, Response> {
actionName = ActionName.GetFriendMsgHistory;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload): Promise<Response> {
const uid = getUidByUin(payload.user_id.toString());
if (!uid) {