【发布时间】:2020-10-01 02:06:16
【问题描述】:
我想针对 10 个查询插入 10 个条目,一个查询。
我需要设置什么吗?我完全不知道该怎么办。
带有示例的回购:https://github.com/mathias22osterhagen22/loopback-array-post-sample
编辑: 人模型.ts:
import {Entity, model, property} from '@loopback/repository';
@model()
export class People extends Entity {
@property({
type: 'number',
id: true,
generated: true,
})
id?: number;
@property({
type: 'string',
required: true,
})
name: string;
constructor(data?: Partial<People>) {
super(data);
}
}
export interface PeopleRelations {
// describe navigational properties here
}
export type PeopleWithRelations = People & PeopleRelations;
【问题讨论】:
-
你还可以添加有问题的模型文件吗,我尝试添加数组来创建端点,它确实一次创建了多个条目。
-
我刚刚编辑了我的帖子 + 我在项目中添加了一个 repo。您是如何设法“添加数组以创建端点”的?抱歉,我不确定我是否理解。
-
我的意思是我在正文中传递了数组,正如您在示例中所展示的那样,它有效。
-
您没有在模型文件中添加或更改任何内容?
标签: post loopbackjs loopback4