feat: 上传文件到minio

This commit is contained in:
2024-10-07 01:54:13 +08:00
parent 477ad00d86
commit 8beb65e637
11 changed files with 195 additions and 104 deletions

View File

@@ -10,10 +10,15 @@ app
})
.define(async (ctx) => {
const tokenUser = ctx.state.tokenUser;
const data = ctx.query.data || {};
if (!data.key) {
throw new CustomError('key is required');
}
const list = await AppListModel.findAll({
order: [['updatedAt', 'DESC']],
where: {
uid: tokenUser.id,
key: data.key,
},
});
ctx.body = list;
@@ -61,6 +66,10 @@ app
}
return;
}
if (!rest.key) {
throw new CustomError('key is required');
}
const app = await AppListModel.create({ data, ...rest, uid: tokenUser.id });
ctx.body = app;
return ctx;
@@ -82,7 +91,9 @@ app
if (!app) {
throw new CustomError('app not found');
}
await app.destroy();
await app.destroy({
force: true,
});
ctx.body = 'success';
return ctx;
})