小编The*_*son的帖子

使用 .withGraphFetched() 时,Vincit/Objection.js 返回“无法读取未定义的属性‘$relation’”

我目前正在使用 NestJS 设置 Objection.js,但在使用任何类型的图形获取或保存方法时遇到问题。相关型号:

资源组.model.ts

import { BaseModel } from './base.model';
import { Model } from 'objection';
import { ResourceGroupTypeModel } from './resource-group-type.model';
import { CollectionModel } from './collection.model';
import { AttributeModel } from './attribute.model';
import { ResourceModel } from './resource.model';

export class ResourceGroupModel extends BaseModel {
  static tableName = 'resource_group';

  typeId: number;
  title: string;
  groupId: string;
  collectionId?: number;
  defaultResourceId?: number;
  isDeleted: boolean;

  static relationMappings = {
    attributes: {
      modelClass: AttributeModel,
      relation: Model.ManyToManyRelation,
      join: {
        from: 'resource_group.id',
        through: {
          from: …
Run Code Online (Sandbox Code Playgroud)

typescript knex.js objection.js nestjs

5
推荐指数
1
解决办法
1233
查看次数

标签 统计

knex.js ×1

nestjs ×1

objection.js ×1

typescript ×1