UNPKG

temporeest

Version:
92 lines (79 loc) 2.45 kB
// SIGNED-SOURCE: <4c6f846c4215d4b8fa3f6bb03df9b9aa> /** * AUTO-GENERATED FILE * Do not modify. Update your schema and re-generate for changes. */ import Slide from "../Slide.js"; import { default as s } from "./SlideSpec.js"; import { P } from "@aphro/runtime-ts"; import { UpdateMutationBuilder } from "@aphro/runtime-ts"; import { CreateMutationBuilder } from "@aphro/runtime-ts"; import { DeleteMutationBuilder } from "@aphro/runtime-ts"; import { makeSavable } from "@aphro/runtime-ts"; import { modelGenMemo } from "@aphro/runtime-ts"; import { Node } from "@aphro/runtime-ts"; import { NodeSpecWithCreate } from "@aphro/runtime-ts"; import { SID_of } from "@aphro/runtime-ts"; import SlideQuery from "./SlideQuery.js"; import { Context } from "@aphro/runtime-ts"; import ComponentQuery from "./ComponentQuery.js"; import Component from "../Component.js"; import Deck from "../Deck.js"; export type Data = { id: SID_of<Slide>; deckId: SID_of<Deck>; order: number; }; // @Sealed(Slide) export default abstract class SlideBase extends Node<Data> { readonly spec = s as unknown as NodeSpecWithCreate<this, Data>; get id(): SID_of<this> { return this.data.id as unknown as SID_of<this>; } get deckId(): SID_of<Deck> { return this.data.deckId; } get order(): number { return this.data.order; } queryComponents(): ComponentQuery { return ComponentQuery.create(this.ctx).whereSlideId( P.equals(this.id as any) ); } static queryAll(ctx: Context): SlideQuery { return SlideQuery.create(ctx); } static genx = modelGenMemo( "none", "slide", (ctx: Context, id: SID_of<Slide>): Promise<Slide> => this.queryAll(ctx).whereId(P.equals(id)).genxOnlyValue() ); static gen = modelGenMemo<Slide, Slide | null>( "none", "slide", (ctx: Context, id: SID_of<Slide>): Promise<Slide | null> => this.queryAll(ctx).whereId(P.equals(id)).genOnlyValue() ); update(data: Partial<Data>) { return makeSavable( this.ctx, new UpdateMutationBuilder(this.ctx, this.spec, this) .set(data) .toChangesets()[0] ); } static create(ctx: Context, data: Partial<Data>) { return makeSavable( ctx, new CreateMutationBuilder(ctx, s).set(data).toChangesets()[0] ); } delete() { return makeSavable( this.ctx, new DeleteMutationBuilder(this.ctx, this.spec, this).toChangesets()[0] ); } }