This commit is contained in:
2024-09-30 01:39:07 +08:00
parent 962d89ff29
commit e05c042827
8 changed files with 152 additions and 9 deletions

View File

@@ -5,10 +5,16 @@ import semver from 'semver';
const list = app.route({
path: 'container',
key: 'list',
middleware: ['auth']
});
list.run = async (ctx) => {
const tokenUser = ctx.state.tokenUser;
const list = await ContainerModel.findAll({
order: [['updatedAt', 'DESC']],
where: {
uid: tokenUser.id,
},
});
ctx.body = list;
return ctx;
@@ -42,10 +48,7 @@ add.run = async (ctx) => {
title: '',
description: '',
code: '',
source: '',
type: '',
sourceType: '',
data: {},
};
const container = {
..._data,
@@ -67,6 +70,8 @@ add.run = async (ctx) => {
try {
containerModel = await ContainerModel.create({
...container,
source: '',
sourceType: '',
});
} catch (e) {
console.log('error', e);

View File

@@ -29,10 +29,15 @@ app
.route({
path: 'page',
key: 'list',
middleware: ['auth'],
})
.define(async (ctx) => {
const tokenUser = ctx.state.tokenUser;
ctx.body = await PageModel.findAll({
order: [['updatedAt', 'DESC']],
where: {
uid: tokenUser.id,
},
});
return ctx;
})

View File

@@ -6,10 +6,15 @@ app
.route({
path: 'resource',
key: 'list',
middleware: ['auth'],
})
.define(async (ctx) => {
const tokenUser = ctx.state.tokenUser;
const list = await ResourceModel.findAll({
order: [['updatedAt', 'DESC']],
where: {
uid: tokenUser.id,
},
});
ctx.body = list;
return ctx;