refactor(api): 🚚 Refactor authentication middleware and implement some OpenAPI routes

This commit is contained in:
Jesse Wierzbinski 2024-08-27 17:20:36 +02:00
parent edf5edca9f
commit 1ab1c68d36
No known key found for this signature in database
66 changed files with 383 additions and 279 deletions

View file

@ -8,6 +8,7 @@ import {
eq,
inArray,
} from "drizzle-orm";
import { z } from "zod";
import { db } from "~/drizzle/db";
import { Relationships } from "~/drizzle/schema";
import { BaseInterface } from "./base";
@ -25,6 +26,23 @@ export class Relationship extends BaseInterface<
typeof Relationships,
RelationshipWithOpposite
> {
static schema = z.object({
id: z.string(),
blocked_by: z.boolean(),
blocking: z.boolean(),
domain_blocking: z.boolean(),
endorsed: z.boolean(),
followed_by: z.boolean(),
following: z.boolean(),
muting_notifications: z.boolean(),
muting: z.boolean(),
note: z.string().nullable(),
notifying: z.boolean(),
requested_by: z.boolean(),
requested: z.boolean(),
showing_reblogs: z.boolean(),
});
async reload(): Promise<void> {
const reloaded = await Relationship.fromId(this.data.id);