暂存
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
})
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user