mirror of
https://github.com/versia-pub/server.git
synced 2026-04-28 05:09:16 +02:00
refactor: ⬆️ Upgrade to Zod v4 and hono-openapi 0.5.0
This commit is contained in:
parent
add2429606
commit
24d4150da4
209 changed files with 1331 additions and 1622 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { z } from "zod";
|
||||
import { z } from "zod/v4";
|
||||
import { Account } from "./account.ts";
|
||||
import { AccountWarning } from "./account-warning.ts";
|
||||
import { Id } from "./common.ts";
|
||||
|
|
@ -7,7 +7,7 @@ import { Status } from "./status.ts";
|
|||
|
||||
export const Notification = z
|
||||
.object({
|
||||
id: Id.openapi({
|
||||
id: Id.meta({
|
||||
description: "The ID of the notification in the database.",
|
||||
example: "6405f495-da55-4ad7-b5d6-9a773360fc07",
|
||||
}),
|
||||
|
|
@ -27,47 +27,46 @@ export const Notification = z
|
|||
"severed_relationships",
|
||||
"moderation_warning",
|
||||
])
|
||||
.openapi({
|
||||
.meta({
|
||||
description:
|
||||
"The type of event that resulted in the notification.",
|
||||
example: "mention",
|
||||
}),
|
||||
group_key: z.string().openapi({
|
||||
group_key: z.string().meta({
|
||||
description:
|
||||
"Group key shared by similar notifications, to be used in the grouped notifications feature.",
|
||||
example: "ungrouped-34975861",
|
||||
}),
|
||||
created_at: z.string().datetime().openapi({
|
||||
created_at: z.iso.datetime().meta({
|
||||
description: "The timestamp of the notification.",
|
||||
example: "2025-01-12T13:11:00Z",
|
||||
}),
|
||||
account: Account.openapi({
|
||||
account: Account.meta({
|
||||
description:
|
||||
"The account that performed the action that generated the notification.",
|
||||
}),
|
||||
status: Status.optional().openapi({
|
||||
status: Status.optional().meta({
|
||||
description:
|
||||
"Status that was the object of the notification. Attached when type of the notification is favourite, reblog, status, mention, poll, or update.",
|
||||
}),
|
||||
report: Report.optional().openapi({
|
||||
report: Report.optional().meta({
|
||||
description:
|
||||
"Report that was the object of the notification. Attached when type of the notification is admin.report.",
|
||||
}),
|
||||
event: z.undefined().openapi({
|
||||
event: z.undefined().meta({
|
||||
description:
|
||||
"Versia Server does not sever relationships, so this field is always empty.",
|
||||
type: "null",
|
||||
}),
|
||||
moderation_warning: AccountWarning.optional().openapi({
|
||||
moderation_warning: AccountWarning.optional().meta({
|
||||
description:
|
||||
"Moderation warning that caused the notification. Attached when type of the notification is moderation_warning.",
|
||||
}),
|
||||
})
|
||||
.openapi({
|
||||
.meta({
|
||||
description:
|
||||
"Represents a notification of an event relevant to the user.",
|
||||
externalDocs: {
|
||||
url: "https://docs.joinmastodon.org/entities/Notification",
|
||||
},
|
||||
ref: "Notification",
|
||||
id: "Notification",
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue