mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor: ♻️ Rewrite build system to fit the monorepo architecture
This commit is contained in:
parent
7de4b573e3
commit
90b6399407
217 changed files with 2143 additions and 1858 deletions
|
|
@ -9,6 +9,7 @@ import {
|
|||
qsQuery,
|
||||
} from "@versia-server/kit/api";
|
||||
import { User } from "@versia-server/kit/db";
|
||||
import { searchManager } from "@versia-server/kit/search";
|
||||
import { Users } from "@versia-server/kit/tables";
|
||||
import { and, eq, isNull } from "drizzle-orm";
|
||||
import { describeRoute } from "hono-openapi";
|
||||
|
|
@ -419,11 +420,14 @@ export default apiRoute((app) => {
|
|||
);
|
||||
}
|
||||
|
||||
await User.register(username, {
|
||||
const user = await User.register(username, {
|
||||
password,
|
||||
email,
|
||||
});
|
||||
|
||||
// Add to search index
|
||||
await searchManager.addUser(user);
|
||||
|
||||
return context.text("", 200);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default apiRoute((app) =>
|
|||
const { user } = context.get("auth");
|
||||
const note = context.get("note");
|
||||
|
||||
await user.like(note);
|
||||
await note.like(user);
|
||||
|
||||
await note.reload(user.id);
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ export default apiRoute((app) => {
|
|||
emoji = unicodeEmoji;
|
||||
}
|
||||
|
||||
await user.react(note, emoji);
|
||||
await note.react(user, emoji);
|
||||
|
||||
// Reload note to get updated reactions
|
||||
await note.reload(user.id);
|
||||
|
|
@ -204,7 +204,7 @@ export default apiRoute((app) => {
|
|||
emoji = unicodeEmoji;
|
||||
}
|
||||
|
||||
await user.unreact(note, emoji);
|
||||
await note.unreact(user, emoji);
|
||||
|
||||
// Reload note to get updated reactions
|
||||
await note.reload(user.id);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ export default apiRoute((app) =>
|
|||
const { user } = context.get("auth");
|
||||
const note = context.get("note");
|
||||
|
||||
const reblog = await user.reblog(note, visibility);
|
||||
const reblog = await note.reblog(user, visibility);
|
||||
|
||||
return context.json(await reblog.toApi(user), 200);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export default apiRoute((app) =>
|
|||
const { user } = context.get("auth");
|
||||
const note = context.get("note");
|
||||
|
||||
await user.unlike(note);
|
||||
await note.unlike(user);
|
||||
|
||||
await note.reload(user.id);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export default apiRoute((app) =>
|
|||
const { user } = context.get("auth");
|
||||
const note = context.get("note");
|
||||
|
||||
await user.unreblog(note);
|
||||
await note.unreblog(user);
|
||||
|
||||
const newNote = await Note.fromId(note.data.id, user.id);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ import { ApiError } from "@versia-server/kit";
|
|||
import { apiRoute, auth, handleZodError } from "@versia-server/kit/api";
|
||||
import { db, Note, User } from "@versia-server/kit/db";
|
||||
import { parseUserAddress } from "@versia-server/kit/parsers";
|
||||
import { searchManager } from "@versia-server/kit/search";
|
||||
import { Instances, Notes, Users } from "@versia-server/kit/tables";
|
||||
import { and, eq, inArray, isNull, sql } from "drizzle-orm";
|
||||
import { describeRoute } from "hono-openapi";
|
||||
import { resolver, validator } from "hono-openapi/zod";
|
||||
import { z } from "zod";
|
||||
import { searchManager } from "~/classes/search/search-manager";
|
||||
|
||||
export default apiRoute((app) =>
|
||||
app.get(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue