Skip to content

Commit

Permalink
refactor: move files
Browse files Browse the repository at this point in the history
  • Loading branch information
simonknittel committed Dec 22, 2024
1 parent 0471c7f commit 4f770a0
Show file tree
Hide file tree
Showing 299 changed files with 436 additions and 452 deletions.
2 changes: 1 addition & 1 deletion app/src/algolia/actions/updateIndices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const updateIndices = async () => {
success: "Successfully updated Algolia indices",
};
} catch (error) {
await log.error("Failed to update Algolia indices", {
void log.error("Failed to update Algolia indices", {
error: serializeError(error),
});

Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/classification-level/[id]/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../lib/apiErrorHandler";

interface Params {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/classification-level/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../lib/apiErrorHandler";

const postBodySchema = z.object({
name: z.string().trim().min(1).max(255),
Expand Down
4 changes: 2 additions & 2 deletions app/src/app/api/confirm-email/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { authenticate } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { log } from "@/logging";
import { NextResponse, type NextRequest } from "next/server";
import { zfd } from "zod-form-data";
import apiErrorHandler from "../../../lib/apiErrorHandler";

export const dynamic = "force-dynamic";

Expand All @@ -18,7 +18,7 @@ export async function GET(request: NextRequest) {
*/
const authentication = await authenticate();
if (!authentication) {
await log.info("Unauthenticated request to API", {
void log.info("Unauthenticated request to API", {
requestPath: "/api/confirm-email",
requestMethod: "GET",
reason: "No session",
Expand Down
4 changes: 2 additions & 2 deletions app/src/app/api/health/throw/route.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { type NextRequest } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../lib/apiErrorHandler";

const bodySchema = z.object({
message: z.string(),
});

export const POST = async (request: NextRequest) => {
try {
const body = await request.json();
const body = (await request.json()) as unknown;
const data = bodySchema.parse(body);
throw new Error(data.message);
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/manufacturer/[id]/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { revalidateTag } from "next/cache";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../lib/apiErrorHandler";

/**
* Make sure this file matches `/src/lib/serverActions/manufacturer.ts`.
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/manufacturer/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { revalidateTag } from "next/cache";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../lib/apiErrorHandler";

const postBodySchema = z.object({
name: z.string().trim().min(1),
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/note-type/[id]/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../lib/apiErrorHandler";

interface Params {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/note-type/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../lib/apiErrorHandler";

const postBodySchema = z.object({
name: z.string().trim().min(1).max(255),
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/operation-member/[operationId]/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../lib/apiErrorHandler";

interface Params {
operationId: string;
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/operation-member/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../lib/apiErrorHandler";

const postBodySchema = z.union([
z.object({
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/operation-unit/[id]/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../lib/apiErrorHandler";

interface Params {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/operation-unit/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../lib/apiErrorHandler";

const postBodySchema = z.object({
operationId: z.string().cuid(),
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/operation/[id]/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../lib/apiErrorHandler";

interface Params {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/operation/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../lib/apiErrorHandler";

const postBodySchema = z.object({
title: z.string().trim().min(1).max(255),
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/role/[id]/permissions/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../../lib/apiErrorHandler";

interface Params {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/role/[id]/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../lib/apiErrorHandler";

interface Params {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/role/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../lib/apiErrorHandler";

const postBodySchema = z.object({
name: z.string().trim().min(1).max(255),
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/series/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { revalidateTag } from "next/cache";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../lib/apiErrorHandler";

const postBodySchema = z.object({
name: z.string().trim().min(1),
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/ship/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../lib/apiErrorHandler";

const postBodySchema = z.object({
variantId: z.string().cuid(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { authenticateApi } from "@/auth/server";
import { confirmLog } from "@/citizen/utils/confirmLog";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../../../../../lib/apiErrorHandler";

interface Params {
id: string;
Expand Down
4 changes: 2 additions & 2 deletions app/src/app/api/spynet/entity/[id]/log/[logId]/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import getLatestNoteAttributes from "@/common/utils/getLatestNoteAttributes";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../../../../lib/apiErrorHandler";
import getLatestNoteAttributes from "../../../../../../../lib/getLatestNoteAttributes";
import { updateAlgoliaWithGenericLogType } from "./_lib/updateAlgoliaWithGenericLogType";
import { updateEntityCaches } from "./_lib/updateEntityCaches";

Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/spynet/entity/[id]/log/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { authenticateApi } from "@/auth/server";
import { confirmLog } from "@/citizen/utils/confirmLog";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../../../lib/apiErrorHandler";
import { updateEntityRolesCache } from "./_lib/updateEntityRolesCache";

interface Params {
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/spynet/entity/[id]/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { deleteObject } from "@/algolia";
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../../lib/apiErrorHandler";

interface Params {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/spynet/entity/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { saveObject } from "@/algolia";
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../lib/apiErrorHandler";

const postBodySchema = z.object({
type: z.literal("citizen"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { updateActiveMembership } from "@/organizations/utils/updateActiveMembership";
import { ConfirmationStatus } from "@prisma/client";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../../../../../lib/apiErrorHandler";

const bodySchema = z.object({
id: z.string().cuid(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { updateActiveMembership } from "@/organizations/utils/updateActiveMembership";
import { ConfirmationStatus, OrganizationMembershipType } from "@prisma/client";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../../../../lib/apiErrorHandler";

type Params = Readonly<{
organizationId: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import {
ConfirmationStatus,
Expand All @@ -7,7 +8,6 @@ import {
} from "@prisma/client";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../../../../lib/apiErrorHandler";

type Params = Readonly<{
organizationId: string;
Expand Down
6 changes: 3 additions & 3 deletions app/src/app/api/spynet/organization/route.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { saveObject } from "@/algolia";
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { scrapeOrganizationLogo } from "@/common/utils/scrapeOrganizationLogo";
import { prisma } from "@/db";
import { log } from "@/logging";
import { ConfirmationStatus } from "@prisma/client";
import { NextResponse } from "next/server";
import { serializeError } from "serialize-error";
import { z } from "zod";
import apiErrorHandler from "../../../../lib/apiErrorHandler";
import { scrapeOrganizationLogo } from "../../../../lib/scrapeOrganizationLogo";

const postBodySchema = z.object({
spectrumId: z.string().trim().min(1),
Expand Down Expand Up @@ -45,7 +45,7 @@ export async function POST(request: Request) {
try {
logo = await scrapeOrganizationLogo(data.spectrumId);
} catch (error) {
await log.error("Failed to scrape organization logo", {
void log.error("Failed to scrape organization logo", {
spectrumId: data.spectrumId,
error: serializeError(error),
});
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/upload/route.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
import { NextResponse } from "next/server";
import { z } from "zod";
import { env } from "../../../env.mjs";
import apiErrorHandler from "../../../lib/apiErrorHandler";

const postBodySchema = z.object({
fileName: z.string().trim().min(1).max(255),
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/api/variant/route.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { authenticateApi } from "@/auth/server";
import apiErrorHandler from "@/common/utils/apiErrorHandler";
import { prisma } from "@/db";
import { VariantStatus } from "@prisma/client";
import { revalidateTag } from "next/cache";
import { NextResponse } from "next/server";
import { z } from "zod";
import apiErrorHandler from "../../../lib/apiErrorHandler";

const postBodySchema = z.object({
name: z.string().trim().min(1),
Expand Down
4 changes: 2 additions & 2 deletions app/src/app/app/_components/CalendarTile.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { getEvents } from "@/discord/getEvents";
import clsx from "clsx";
import dynamic from "next/dynamic";
import { getEvents } from "../../../discord/getEvents";
import { Event } from "./Event";

const TimeAgoContainer = dynamic(
() => import("../../_components/TimeAgoContainer"),
() => import("@/common/components/TimeAgoContainer"),
{
ssr: false,
loading: () => (
Expand Down
4 changes: 2 additions & 2 deletions app/src/app/app/_components/Event.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { requireAuthentication } from "@/auth/server";
import { DiscordButton } from "@/common/components/DiscordButton";
import TimeAgoContainer from "@/common/components/TimeAgoContainer";
import clsx from "clsx";
import Image from "next/image";
import Link from "next/link";
import { DiscordButton } from "../../_components/DiscordButton";
import TimeAgoContainer from "../../_components/TimeAgoContainer";

type Props = Readonly<{
className?: string;
Expand Down
Loading

0 comments on commit 4f770a0

Please sign in to comment.