Commit 4c4f9f83 authored by Jan Minář's avatar Jan Minář
Browse files

Merge branch 'master' of gitlab.fi.muni.cz:xuhlarik/pcbuilder

parents 7f5ab49c 60e5db56
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
-- AlterTable
ALTER TABLE "Build" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "Category" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "FormFactor" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "IntegratedGraphics" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "Manufacturer" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "Memory" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "MemoryGeneration" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "Motherboard" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "MotherboardChipset" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "MotherboardPcieSlot" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "PcieGeneration" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "Preset" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "Processor" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "Socket" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "VideoCard" ADD COLUMN "deletedAt" DATETIME;

-- AlterTable
ALTER TABLE "VideoChipset" ADD COLUMN "deletedAt" DATETIME;
+20 −4
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ model Preset {
  category    Category  @relation(fields: [categoryId], references: [id])
  buildId     String
  build       Build     @relation(fields: [buildId], references: [id])
  deletedAt   DateTime?
}

model Category {
@@ -36,6 +37,7 @@ model Category {
  name        String
  description String
  preset      Preset[]
  deletedAt   DateTime?
}

model Build {
@@ -49,6 +51,7 @@ model Build {
  videoCardId   String?
  videoCard     VideoCard?   @relation(fields: [videoCardId], references: [id])
  preset        Preset[]
  deletedAt     DateTime?
}

model Processor {
@@ -63,12 +66,14 @@ model Processor {
  integratedGraphics   IntegratedGraphics? @relation(fields: [integratedGraphicsId], references: [id])
  integratedGraphicsId String?
  image                String
  deletedAt            DateTime?
}

model IntegratedGraphics {
  id        String      @id @default(uuid())
  name      String
  processor Processor[]
  deletedAt DateTime?
}

model Socket {
@@ -76,6 +81,7 @@ model Socket {
  name        String
  processor   Processor[]
  motherboard Motherboard[]
  deletedAt   DateTime?
}

model Motherboard {
@@ -94,12 +100,14 @@ model Motherboard {
  chipsetId       String
  pcieSlots       MotherboardPcieSlot[]
  image           String
  deletedAt       DateTime?
}

model FormFactor {
  id           String        @id @default(uuid())
  name         String
  motherboards Motherboard[]
  deletedAt    DateTime?
}

model VideoCard {
@@ -115,6 +123,7 @@ model VideoCard {
  chipsetId        String
  slotSize         Int
  image            String
  deletedAt        DateTime?
}

model Manufacturer {
@@ -126,6 +135,7 @@ model Manufacturer {
  memories            Memory[]
  motherboardChipsets MotherboardChipset[]
  videoChipsets       VideoChipset[]
  deletedAt           DateTime?
}

model Memory {
@@ -138,6 +148,7 @@ model Memory {
  price              Decimal
  builds             Build[]
  image              String
  deletedAt          DateTime?
}

model MemoryGeneration {
@@ -145,6 +156,7 @@ model MemoryGeneration {
  name                String
  memories            Memory[]
  motherboardChipsets MotherboardChipset[]
  deletedAt           DateTime?
}

model MotherboardChipset {
@@ -155,6 +167,7 @@ model MotherboardChipset {
  memoryGeneration   MemoryGeneration @relation(fields: [memoryGenerationId], references: [id])
  memoryGenerationId String
  motherboards       Motherboard[]
  deletedAt          DateTime?
}

model PcieGeneration {
@@ -162,6 +175,7 @@ model PcieGeneration {
  name                 String
  motherboardPcieSlots MotherboardPcieSlot[]
  videoCards           VideoCard[]
  deletedAt            DateTime?
}

model MotherboardPcieSlot {
@@ -172,6 +186,7 @@ model MotherboardPcieSlot {
  pcieGeneration   PcieGeneration @relation(fields: [pcieGenerationId], references: [id])
  size             Int
  count            Int
  deletedAt        DateTime?
}

model VideoChipset {
@@ -180,4 +195,5 @@ model VideoChipset {
  manufacturerId String
  manufacturer   Manufacturer @relation(fields: [manufacturerId], references: [id])
  videoCards     VideoCard[]
  deletedAt      DateTime?
}
+2 −1
Original line number Diff line number Diff line
@@ -3,8 +3,9 @@ import prisma from '../client';
import { withTranslatedErrors } from '../errors';
import { validateBuild } from './common';
import include from './include';
import type { CreateData } from '../common';

export type BuildCreateData = Omit<Build, 'id'>;
export type BuildCreateData = CreateData<Build>;

export const createBuild = withTranslatedErrors(
  async (data: BuildCreateData) => {
+2 −1
Original line number Diff line number Diff line
@@ -6,7 +6,8 @@ export type BuildDeleteData = Pick<Build, 'id'>;

export const deleteBuild = withTranslatedErrors(
  async (data: BuildDeleteData) => {
    const result = await prisma.build.delete({
    const result = await prisma.build.update({
      data: { deletedAt: new Date() },
      where: { id: data.id },
    });

+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ export const readManyBuild = withTranslatedErrors(
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  async (_data: BuildReadManyData) => {
    const result = await prisma.build.findMany({
      where: { deletedAt: null },
      include,
    });
    return result;
Loading