UNPKG

@webda/core

Version:

Expose API with Lambda

51 lines (50 loc) 1.34 kB
import { OperationContext } from "../utils/context.js"; import { UuidModel } from "./coremodel.js"; import { ModelLink } from "./relations.js"; import { User } from "./user.js"; /** * @WebdaModel */ export declare class OwnerModel extends UuidModel { /** * Default owner of the object */ _user: ModelLink<User>; /** * Define if the object is publicly readable * @default false */ public?: boolean; /** * UUID of the object * @readonly */ uuid: string; /** * Set object owner * @param uuid */ setOwner(uuid: string): void; /** * @override */ validate(ctx: OperationContext<any, any>, updates: any, ignoreRequired?: boolean): Promise<boolean>; /** * Return the owner of the object * * Only the owner can do update to the object * @returns */ getOwner(): ModelLink<User>; canAct(ctx: OperationContext, action: "create" | "update" | "get" | "delete" | "get_binary" | "detach_binary" | "attach_binary" | "update_binary_metadata" | string): Promise<string | boolean>; /** * Return a query to filter OwnerModel * * @param context * @returns */ static getPermissionQuery(context?: OperationContext): null | { partial: boolean; query: string; }; }