Skip to content

Commit

Permalink
Production deployment (#1007)
Browse files Browse the repository at this point in the history
**Only merge using a merge commit!**
  • Loading branch information
simonknittel authored Dec 22, 2024
2 parents 3550b96 + d0aed46 commit 122f084
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 28 deletions.
17 changes: 17 additions & 0 deletions app/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,25 @@ model Variant {
series Series @relation(fields: [seriesId], references: [id], onDelete: Cascade)
ships Ship[]
status VariantStatus?
tags VariantTags[]
@@unique([name, seriesId])
}

model VariantTags {
id String @id @default(cuid())
key String
value String
variants Variant[]
createdAt DateTime @default(now())
createdById String
createdBy User @relation("createdBy", fields: [createdById], references: [id])
updatedAt DateTime @updatedAt
updatedById String?
updatedBy User? @relation("updatedBy", fields: [updatedById], references: [id])
}

enum VariantStatus {
FLIGHT_READY
NOT_FLIGHT_READY
Expand Down Expand Up @@ -256,6 +271,8 @@ model User {
lastSeenAt DateTime?
uploads Upload[]
emailConfirmationTokens EmailConfirmationToken[]
createdVariantTags VariantTags[] @relation("createdBy")
updatedVariantTags VariantTags[] @relation("updatedBy")
}

model VerificationToken {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const AddNote = ({
)}

<div className="flex gap-4 items-center justify-end col-start-3">
<Button
{/* <Button
type="submit"
disabled={isLoading}
title="Speichern"
Expand All @@ -127,7 +127,7 @@ export const AddNote = ({
Speichern und
<br />
bestätigen
</Button>
</Button> */}

<Button
type="submit"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import getAllClassificationLevels from "@/common/utils/cached/getAllClassificationLevels";
import getLatestNoteAttributes from "@/common/utils/getLatestNoteAttributes";
import {
type EntityLog,
type EntityLogAttribute,
type User,
} from "@prisma/client";
import { type EntityLog, type EntityLogAttribute } from "@prisma/client";
import clsx from "clsx";

interface Props {
type Props = Readonly<{
className?: string;
note: EntityLog & {
attributes: (EntityLogAttribute & { createdBy: User })[];
attributes: EntityLogAttribute[];
};
}
}>;

const ClassificationLevel = async ({ className, note }: Readonly<Props>) => {
export const ClassificationLevel = async ({ className, note }: Props) => {
const allClassificationLevels = await getAllClassificationLevels();
const { classificationLevelId } = getLatestNoteAttributes(note);

Expand All @@ -27,5 +23,3 @@ const ClassificationLevel = async ({ className, note }: Readonly<Props>) => {
</p>
);
};

export default ClassificationLevel;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { authenticate } from "@/auth/server";
import { requireAuthentication } from "@/auth/server";
import TabPanel from "@/common/components/tabs/TabPanel";
import getAllClassificationLevels from "@/common/utils/cached/getAllClassificationLevels";
import {
Expand All @@ -25,7 +25,7 @@ type Props = Readonly<{

export const NoteTypePanel = async ({ noteType, notes, entityId }: Props) => {
const [authentication, allClassificationLevels] = await Promise.all([
authenticate(),
requireAuthentication(),
getAllClassificationLevels(),
]);

Expand All @@ -34,14 +34,12 @@ export const NoteTypePanel = async ({ noteType, notes, entityId }: Props) => {
isAllowedToCreate(classificationLevel.id, authentication, noteType.id),
);

const showAddNote =
authentication &&
authentication.authorize("note", "create", [
{
key: "noteTypeId",
value: noteType.id,
},
]);
const showAddNote = authentication.authorize("note", "create", [
{
key: "noteTypeId",
value: noteType.id,
},
]);

return (
<TabPanel id={noteType.id}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
type EntityLog,
type EntityLogAttribute,
type Organization,
type User,
} from "@prisma/client";
import clsx from "clsx";
import Image from "next/image";
Expand All @@ -19,14 +18,13 @@ import { FaInfoCircle } from "react-icons/fa";
import { TbCircleDot } from "react-icons/tb";
import ConfirmLog from "../ConfirmLog";
import DeleteLog from "../DeleteLog";
import ClassificationLevel from "./ClassificationLevel";
import { ClassificationLevel } from "./ClassificationLevel";
import ClassificationLevelSkeleton from "./ClassificationLevelSkeleton";
import UpdateNote from "./UpdateNote";

type Props = Readonly<{
note: EntityLog & {
attributes: (EntityLogAttribute & { createdBy: User })[];
submittedBy: User;
attributes: EntityLogAttribute[];
};
}>;

Expand All @@ -36,6 +34,7 @@ export const SingleNote = async ({ note }: Props) => {
const { noteTypeId, classificationLevelId, confirmed } =
getLatestNoteAttributes(note);

// @ts-expect-error The authorization types need to get overhauled
const authorizationAttributes: PermissionSet["attributes"] = [
...(noteTypeId ? [{ key: "noteTypeId", value: noteTypeId.value }] : []),
...(classificationLevelId
Expand All @@ -49,7 +48,7 @@ export const SingleNote = async ({ note }: Props) => {
let content: ReactNode = note.content;
const matches = note.content?.match(/@citizen:(\d+)|@org:([a-zA-Z]+)/g);
if (matches) {
const uniqueCitizenSpectrumIds = new Set<Entity["spectrumId"]>(
const uniqueCitizenSpectrumIds = new Set<string>(
matches
.filter((match) => match.startsWith("@citizen:"))
.map((match) => match.slice(9)),
Expand Down

0 comments on commit 122f084

Please sign in to comment.