mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 00:18:19 +01:00
revert(api): 🔥 Use Notification's schema declaration instead of declaring it again every time
This commit is contained in:
parent
8765a45240
commit
ca31830fb3
|
|
@ -1,6 +1,6 @@
|
|||
import { apiRoute, applyConfig, auth } from "@/api";
|
||||
import { createRoute } from "@hono/zod-openapi";
|
||||
import { Note, Notification, User } from "@versia/kit/db";
|
||||
import { Notification } from "@versia/kit/db";
|
||||
import { RolePermissions } from "@versia/kit/tables";
|
||||
import { z } from "zod";
|
||||
import { ErrorSchema } from "~/types/api";
|
||||
|
|
@ -37,36 +37,7 @@ const route = createRoute({
|
|||
responses: {
|
||||
200: {
|
||||
description: "Notification",
|
||||
schema: z.object({
|
||||
account: z.lazy(() => User.schema).nullable(),
|
||||
created_at: z.string(),
|
||||
id: z.string().uuid(),
|
||||
status: z.lazy(() => Note.schema).optional(),
|
||||
// TODO: Add reactions
|
||||
type: z.enum([
|
||||
"mention",
|
||||
"status",
|
||||
"follow",
|
||||
"follow_request",
|
||||
"reblog",
|
||||
"poll",
|
||||
"favourite",
|
||||
"update",
|
||||
"admin.sign_up",
|
||||
"admin.report",
|
||||
"chat",
|
||||
"pleroma:chat_mention",
|
||||
"pleroma:emoji_reaction",
|
||||
"pleroma:event_reminder",
|
||||
"pleroma:participation_request",
|
||||
"pleroma:participation_accepted",
|
||||
"move",
|
||||
"group_reblog",
|
||||
"group_favourite",
|
||||
"user_approved",
|
||||
]),
|
||||
target: z.lazy(() => User.schema).optional(),
|
||||
}),
|
||||
schema: Notification.schema,
|
||||
},
|
||||
401: {
|
||||
description: "Unauthorized",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { apiRoute, applyConfig, auth, idValidator } from "@/api";
|
||||
import { createRoute } from "@hono/zod-openapi";
|
||||
import { Note, Timeline, User } from "@versia/kit/db";
|
||||
import { Notification, Timeline } from "@versia/kit/db";
|
||||
import { Notifications, RolePermissions } from "@versia/kit/tables";
|
||||
import { and, eq, gt, gte, inArray, lt, not, sql } from "drizzle-orm";
|
||||
import { z } from "zod";
|
||||
|
|
@ -102,17 +102,7 @@ const route = createRoute({
|
|||
description: "Notifications",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: z.array(
|
||||
z.object({
|
||||
account: z.lazy(() => User.schema).nullable(),
|
||||
created_at: z.string(),
|
||||
id: z.string().uuid(),
|
||||
status: z.lazy(() => Note.schema).optional(),
|
||||
// TODO: Add reactions
|
||||
type: z.string(),
|
||||
target: z.lazy(() => User.schema).optional(),
|
||||
}),
|
||||
),
|
||||
schema: z.array(Notification.schema),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue