2025-11-21 08:31:02 +01:00
|
|
|
import type { z } from "zod";
|
2025-04-08 16:01:10 +02:00
|
|
|
import { VoteSchema } from "../../schemas/extensions/polls.ts";
|
|
|
|
|
import type { JSONObject } from "../../types.ts";
|
|
|
|
|
import { Entity } from "../entity.ts";
|
|
|
|
|
|
|
|
|
|
export class Vote extends Entity {
|
2025-05-23 17:29:27 +02:00
|
|
|
public static override name = "pub.versia:polls/Vote";
|
2025-04-08 16:01:10 +02:00
|
|
|
|
2025-05-23 17:29:27 +02:00
|
|
|
public constructor(public override data: z.infer<typeof VoteSchema>) {
|
2025-04-08 16:01:10 +02:00
|
|
|
super(data);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 17:29:27 +02:00
|
|
|
public static override fromJSON(json: JSONObject): Promise<Vote> {
|
2025-04-08 16:01:10 +02:00
|
|
|
return VoteSchema.parseAsync(json).then((u) => new Vote(u));
|
|
|
|
|
}
|
|
|
|
|
}
|