Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions scripts/test/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ const { values } = parseArgs({
});

// check --skip-db-reset param
const shouldSkipDbReset =
values["skip-db-reset"] ?? testEnv.SKIP_DB_RESET;
const shouldSkipDbReset = values["skip-db-reset"] ?? testEnv.SKIP_DB_RESET;
const isWatchMode = values.watch || false;

// Performance options
Expand Down
4 changes: 2 additions & 2 deletions src/core/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Elysia } from "elysia";
import { articlesPlugin as articles } from "@/articles/articles.plugin";
import { commentsPlugin as comments } from "@/comments/comments.plugin";
import { profiles } from "@/profiles/profiles.plugin";
import { tags } from "@/tags/tags.plugin";
import { usersPlugin as users } from "@/users/users.plugin";
import { tags } from "@/tags/tags.controller";
import { usersPlugin as users } from "@/users/users.controller";
import { errors, openapi } from "./plugins";
import { health } from "./plugins/health.plugin";

Expand Down
8 changes: 3 additions & 5 deletions src/tags/tags.plugin.ts → src/tags/tags.controller.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { Elysia, t } from "elysia";
import { db } from "@/core/db";
import * as TagsService from "./tags.service";

export const tags = new Elysia({
tags: ["Tags"],
}).get(
"/tags",
async () => {
const allTags = await db.tag.findMany();
return {
tags: allTags.map((tag) => tag.name),
};
const tags = await TagsService.findAll();
return { tags };
},
{
detail: {
Expand Down
6 changes: 6 additions & 0 deletions src/tags/tags.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { Tag } from "@prisma/client";
import { db } from "@/core/db";

export async function findAll(): Promise<Tag[]> {
return await db.tag.findMany();
}
File renamed without changes.
Empty file added src/users/users.service.ts
Empty file.