mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
17 lines
510 B
TypeScript
17 lines
510 B
TypeScript
|
|
import type { z } from "zod";
|
||
|
|
import { ShareSchema } from "../../schemas/extensions/share.ts";
|
||
|
|
import type { JSONObject } from "../../types.ts";
|
||
|
|
import { Entity } from "../entity.ts";
|
||
|
|
|
||
|
|
export class Share extends Entity {
|
||
|
|
public static name = "pub.versia:share/Share";
|
||
|
|
|
||
|
|
public constructor(public data: z.infer<typeof ShareSchema>) {
|
||
|
|
super(data);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static fromJSON(json: JSONObject): Promise<Share> {
|
||
|
|
return ShareSchema.parseAsync(json).then((u) => new Share(u));
|
||
|
|
}
|
||
|
|
}
|