Fixed 267U.pre2
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import define from "../../define.js";
|
||||
import { Apps } from "../../../../models/index.js";
|
||||
export const meta = {
|
||||
tags: [
|
||||
"account",
|
||||
"app"
|
||||
],
|
||||
requireCredential: true,
|
||||
res: {
|
||||
type: "array",
|
||||
optional: false,
|
||||
nullable: false,
|
||||
items: {
|
||||
type: "object",
|
||||
optional: false,
|
||||
nullable: false,
|
||||
ref: "App"
|
||||
}
|
||||
}
|
||||
};
|
||||
export const paramDef = {
|
||||
type: "object",
|
||||
properties: {
|
||||
limit: {
|
||||
type: "integer",
|
||||
minimum: 1,
|
||||
maximum: 100,
|
||||
default: 10
|
||||
},
|
||||
offset: {
|
||||
type: "integer",
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
required: []
|
||||
};
|
||||
export default define(meta, paramDef, async (ps, user)=>{
|
||||
const query = {
|
||||
userId: user.id
|
||||
};
|
||||
const apps = await Apps.find({
|
||||
where: query,
|
||||
take: ps.limit,
|
||||
skip: ps.offset
|
||||
});
|
||||
return await Promise.all(apps.map((app)=>Apps.pack(app, user, {
|
||||
detail: true
|
||||
})));
|
||||
});
|
||||
Reference in New Issue
Block a user