mirror of
https://github.com/versia-pub/server.git
synced 2026-04-27 12:49:16 +02:00
Some checks failed
CodeQL Scan / Analyze (push) Failing after 0s
Deploy Docs to GitHub Pages / build (push) Failing after 0s
Deploy Docs to GitHub Pages / Deploy (push) Has been skipped
Nix Build / check (push) Failing after 0s
Test Publish / build (client) (push) Failing after 0s
Test Publish / build (sdk) (push) Failing after 0s
Build Docker Images / lint (push) Has been cancelled
Build Docker Images / check (push) Has been cancelled
Build Docker Images / tests (push) Has been cancelled
Build Docker Images / detect-circular (push) Has been cancelled
Mirror to Codeberg / Mirror (push) Has been cancelled
Build Docker Images / build (server, Dockerfile, ${{ github.repository_owner }}/server) (push) Has been cancelled
Build Docker Images / build (worker, Worker.Dockerfile, ${{ github.repository_owner }}/worker) (push) Has been cancelled
32 lines
912 B
TypeScript
32 lines
912 B
TypeScript
import type { z } from "zod";
|
|
import { DeleteSchema } from "../schemas/delete.ts";
|
|
import type { JSONObject } from "../types.ts";
|
|
import { Entity, Reference } from "./entity.ts";
|
|
|
|
export class Delete extends Entity {
|
|
public static override name = "Delete";
|
|
|
|
public constructor(
|
|
public override data: z.infer<typeof DeleteSchema>,
|
|
instanceDomain: string,
|
|
) {
|
|
super(data, instanceDomain);
|
|
}
|
|
|
|
public get author(): Reference {
|
|
return Reference.fromString(this.data.author, this.instanceDomain);
|
|
}
|
|
|
|
public get deleted(): Reference {
|
|
return Reference.fromString(this.data.deleted, this.instanceDomain);
|
|
}
|
|
|
|
public static override fromJSON(
|
|
json: JSONObject,
|
|
instanceDomain: string,
|
|
): Promise<Delete> {
|
|
return DeleteSchema.parseAsync(json).then(
|
|
(u) => new Delete(u, instanceDomain),
|
|
);
|
|
}
|
|
}
|