mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 13:59:16 +01:00
refactor(api): 🏷️ Port all /api/v1/accounts to use new schemas
Some checks failed
Mirror to Codeberg / Mirror (push) Failing after 0s
Some checks failed
Mirror to Codeberg / Mirror (push) Failing after 0s
This commit is contained in:
parent
a0ce18337a
commit
e3e285571e
44 changed files with 840 additions and 475 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { userAddressValidator } from "@/api.ts";
|
||||
import { z } from "@hono/zod-openapi";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager";
|
||||
|
|
@ -126,7 +127,6 @@ export const Account = z.object({
|
|||
.min(3)
|
||||
.trim()
|
||||
.max(config.validation.max_username_size)
|
||||
.toLowerCase()
|
||||
.regex(
|
||||
/^[a-z0-9_-]+$/,
|
||||
"Username can only contain letters, numbers, underscores and hyphens",
|
||||
|
|
@ -142,14 +142,19 @@ export const Account = z.object({
|
|||
url: "https://docs.joinmastodon.org/entities/Account/#username",
|
||||
},
|
||||
}),
|
||||
acct: z.string().openapi({
|
||||
description:
|
||||
"The Webfinger account URI. Equal to username for local users, or username@domain for remote users.",
|
||||
example: "lexi@beta.versia.social",
|
||||
externalDocs: {
|
||||
url: "https://docs.joinmastodon.org/entities/Account/#acct",
|
||||
},
|
||||
}),
|
||||
acct: z
|
||||
.string()
|
||||
.min(1)
|
||||
.trim()
|
||||
.regex(userAddressValidator, "Invalid user address")
|
||||
.openapi({
|
||||
description:
|
||||
"The Webfinger account URI. Equal to username for local users, or username@domain for remote users.",
|
||||
example: "lexi@beta.versia.social",
|
||||
externalDocs: {
|
||||
url: "https://docs.joinmastodon.org/entities/Account/#acct",
|
||||
},
|
||||
}),
|
||||
url: z
|
||||
.string()
|
||||
.url()
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export const Relationship = z
|
|||
description: "Are you featuring this user on your profile?",
|
||||
example: false,
|
||||
}),
|
||||
note: z.string().openapi({
|
||||
note: z.string().min(0).max(5000).trim().openapi({
|
||||
description: "This user’s profile bio",
|
||||
example: "they also like Kerbal Space Program",
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue