UNPKG

@terabits/grapi

Version:

Grapi Schema Generator For GraphQL Server

32 lines (31 loc) 1.03 kB
import { Model, RelationType } from '../dataModel'; import { Relation, WithForeignKey } from './interface'; export default class UniToOne implements Relation, WithForeignKey { private sourceModel; private targetModel; private relationField; private foreignKey; constructor({ sourceModel, targetModel, relationField, foreignKey, }: { sourceModel: Model; targetModel: Model; relationField: string; foreignKey?: string; }); getType(): RelationType; getForeignKey(): string; getForeignKeyConfig(): Array<any>; getRelationField(): string; setForeignKey(targetId: string): { [x: string]: any; }; createAndSetForeignKey(targetData: Record<string, any>, context: any): Promise<{ [x: string]: any; }>; destroyAndUnsetForeignKey(data: Record<string, any>, context: any): Promise<{ [x: string]: any; }>; unsetForeignKey(): { [x: string]: any; }; join(data: Record<string, any>, _: any): Promise<any>; }