style: folder

This commit is contained in:
手瓜一十雪 2024-09-12 19:55:26 +08:00
parent edf80775b7
commit d89620d7a6
5 changed files with 10 additions and 6 deletions

View File

@ -7,17 +7,18 @@ const SchemaData = {
properties: {
group_id: { type: ['string', 'number'] },
folder_id: { type: 'string' },
folder: { type: 'string' }
},
required: ['group_id', 'folder_id'],
required: ['group_id'],
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
export class DeleteGroupFileFolder extends BaseAction<Payload, any> {
export class DeleteGroupFileFolder extends BaseAction<Payload, any> {
actionName = ActionName.GoCQHTTP_DeleteGroupFileFolder;
payloadSchema = SchemaData;
async _handle(payload: Payload) {
return (await this.core.apis.GroupApi.DelGroupFileFolder(
payload.group_id.toString(), payload.folder_id)).groupFileCommonResult;
payload.group_id.toString(), payload.folder ?? payload.folder_id ?? '')).groupFileCommonResult;
}
}

View File

@ -8,9 +8,10 @@ const SchemaData = {
properties: {
group_id: { type: ['string', 'number'] },
folder_id: { type: 'string' },
folder: { type: 'string' },
file_count: { type: ['string', 'number'] },
},
required: ['group_id', 'folder_id'],
required: ['group_id'],
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
@ -26,7 +27,7 @@ export class GetGroupFilesByFolder extends BaseAction<any, any> {
startIndex: 0,
sortOrder: 2,
showOnlinedocFolder: 0,
folderId: payload.folder_id,
folderId: payload.folder ?? payload.folder_id ?? '',
}).catch(() => []);
return {
files: ret.filter(item => item.fileInfo)

View File

@ -41,7 +41,7 @@ export default class GoCQHTTPUploadGroupFile extends BaseAction<Payload, null> {
peer: peer,
deleteAfterSentFiles: []
};
const sendFileEle = await this.core.apis.FileApi.createValidSendFileElement(msgContext, downloadResult.path, payload.name, payload.folder_id);
const sendFileEle = await this.core.apis.FileApi.createValidSendFileElement(msgContext, downloadResult.path, payload.name, payload.folder ?? payload.folder_id);
await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(peer, [sendFileEle], [], true);
return null;
}

View File

@ -126,6 +126,7 @@ export class OB11Entities {
return {
group_id: parseInt(peerId),
folder_id: folder.folderId,
folder:folder.folderId,
folder_name: folder.folderName,
create_time: folder.createTime,
creator: parseInt(folder.createUin),

View File

@ -81,6 +81,7 @@ export interface OB11GroupFile {
export interface OB11GroupFileFolder {
group_id: number,
folder_id: string,
folder: string,
folder_name: string,
create_time: number,
creator: number,