Added some prisma schema changes. (untested)
- Not fully implemented yet. - Renamed ToDo -> TODO
This commit is contained in:
parent
75a5580366
commit
6344134a9e
@ -33,17 +33,24 @@ enum Status {
|
||||
}
|
||||
|
||||
model Item {
|
||||
id Int @id @default(autoincrement())
|
||||
id Int @id @unique @default(autoincrement())
|
||||
SKU String? @unique
|
||||
Amount Int
|
||||
Comment String?
|
||||
amount Int @default(1)
|
||||
name String
|
||||
manufacturer String
|
||||
Comment String?
|
||||
status Status @default(normal) /// TODO: Would it be better to create a separate model for this as well instead of providing several static statuses to choose from(enum)?
|
||||
|
||||
manufacturer String /// TODO: Do we need this as a mandatory field? Probably we can add another model for manufacturer.
|
||||
|
||||
category Category @relation(fields: [categoryId], references: [id])
|
||||
categoryId Int
|
||||
status Status
|
||||
StorageLocation StorageLocation? @relation(fields: [storageLocationId], references: [id])
|
||||
|
||||
items Item[] @relation("items") /// Item beinhaltet..
|
||||
baseItem Item[] @relation("items") /// Item zugehörig zu.
|
||||
|
||||
storageLocation StorageLocation? @relation(fields: [storageLocationId], references: [id])
|
||||
storageLocationId Int?
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
importedBy String?
|
||||
@ -51,12 +58,13 @@ model Item {
|
||||
|
||||
model StorageLocation {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
name String @unique /// This is our LocationID for external use prefixed with: '%StorageUnit%_'
|
||||
storageUnit StorageUnit? @relation(fields: [storageUnitId], references: [id])
|
||||
storageUnitId Int?
|
||||
Item Item[]
|
||||
}
|
||||
|
||||
/// A StorageUnit is the base and can hold multiple StorageLocations.
|
||||
model StorageUnit {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
@ -74,3 +82,22 @@ model Category {
|
||||
description String?
|
||||
Item Item[]
|
||||
}
|
||||
|
||||
/// TODO: Add relationship to StorageUnit, Item and if necessary to StorageLocation.
|
||||
model Owner {
|
||||
id Int @id @default(autoincrement())
|
||||
type OwnerType @default(person)
|
||||
name String
|
||||
lastName String?
|
||||
street String
|
||||
houseNumber String
|
||||
zipCode String
|
||||
city String
|
||||
country String
|
||||
}
|
||||
|
||||
enum OwnerType {
|
||||
person
|
||||
customer
|
||||
company
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ export default class config {
|
||||
}
|
||||
|
||||
// BUG: If file does'nt exist -> fail.
|
||||
// ToDo: Check for SyntaxError on fileread and ask if the user wants to continue -> overwrite everything. This behavior is currently standard.
|
||||
// TODO: Check for SyntaxError on fileread and ask if the user wants to continue -> overwrite everything. This behavior is currently standard.
|
||||
|
||||
/*
|
||||
|
||||
|
@ -55,7 +55,7 @@ export default (req: Request, res: Response) => {
|
||||
const promise = prisma.item.create({
|
||||
data: {
|
||||
name: record.name,
|
||||
Amount: parseInt(record.amount),
|
||||
amount: parseInt(record.amount),
|
||||
Comment: record.comment,
|
||||
category: {
|
||||
connect: {
|
||||
|
Loading…
Reference in New Issue
Block a user