diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 181ad78..fa19a9d 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -34,8 +34,8 @@ model Item {
manufacturer String
category Category
status Status
- StorageLocation StorageLocation @relation(fields: [storageLocationId], references: [id])
- storageLocationId Int
+ StorageLocation StorageLocation? @relation(fields: [storageLocationId], references: [id])
+ storageLocationId Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
@@ -43,8 +43,8 @@ model Item {
model StorageLocation {
id Int @id @default(autoincrement())
name String
- storageBuilding StorageBuilding @relation(fields: [storageBuildingId], references: [id])
- storageBuildingId Int
+ storageBuilding StorageBuilding? @relation(fields: [storageBuildingId], references: [id])
+ storageBuildingId Int?
Item Item[]
}
diff --git a/src/frontend/demopage.eta.html b/src/frontend/demopage.eta.html
index 17e503a..8ce42be 100644
--- a/src/frontend/demopage.eta.html
+++ b/src/frontend/demopage.eta.html
@@ -1,4 +1,4 @@
-<%~ E.includeFile("head.eta.html") %>
+<%~ E.includeFile("head.eta.html", {"title": "Bootstrap Demo Page"}) %>
A simple primary alert—check it out!
diff --git a/src/frontend/head.eta.html b/src/frontend/head.eta.html
index 5b386b8..20c4661 100644
--- a/src/frontend/head.eta.html
+++ b/src/frontend/head.eta.html
@@ -5,7 +5,7 @@
-
AssetFlow - Info about item
+
AssetFlow - <%= it.title %>
diff --git a/src/frontend/publicInfoPage.eta.html b/src/frontend/publicInfoPage.eta.html
index d89ca78..04df85d 100644
--- a/src/frontend/publicInfoPage.eta.html
+++ b/src/frontend/publicInfoPage.eta.html
@@ -1,24 +1,5 @@
-
+<%~ E.includeFile("head.eta.html", {"title": "Item Info"}) %>
-
-
-
-
-
-
AssetFlow - Info about item
-
-
-
-
-
-
-
-
-
-
-
-
-
Category: <%= it.category%>
@@ -27,5 +8,5 @@
Comment: <%= it.comment %>
-
-
+
+<%~ E.includeFile("foot.eta.html") %>
\ No newline at end of file
diff --git a/src/routes/dev/setDemoData.ts b/src/routes/dev/setDemoData.ts
index d527736..c8c1cd8 100644
--- a/src/routes/dev/setDemoData.ts
+++ b/src/routes/dev/setDemoData.ts
@@ -1,52 +1,25 @@
import { Request, Response } from 'express';
import { prisma } from '../../index.js';
+import { Status, Category } from '@prisma/client';
+
export default (req: Request, res: Response) => {
- /*
// fill database with demo data
- prisma.StorageBuilding.create({
- data: {
- name: 'Test Storage Building',
- street: 'Test Street',
- houseNumber: '1',
- zipCode: '12345',
- city: 'Test City',
- country: 'Test Country'
- }
- }).then(() => {
- prisma.StorageLocation.create({
+
+ prisma.item
+ .create({
data: {
- name: 'Test Storage Location',
- StorageBuilding: {
- connect: {
- id: 1
- }
- }
+ SKU: 'ee189749',
+ Amount: 1,
+ name: 'Test Item',
+ manufacturer: 'Test Manufacturer',
+ category: Category.Other,
+ status: Status.normal
}
- }).then(() => {
- prisma.item
- .create({
- data: {
- SKU: 'ee189749',
- Amount: 1,
- name: 'Test Item',
- manufacturer: 'Test Manufacturer',
- category: Category.Other,
- status: Status.normal,
- storageLocation: {
- connect: {
- id: 1
- }
- }
- }
- })
- .then(() => {
- res.send('Demo data added');
- })
- .catch((err) => {
- res.send('Error adding demo data: ' + err);
- });
+ })
+ .then(() => {
+ res.send('Demo data added');
+ })
+ .catch((err) => {
+ res.send('Error adding demo data: ' + err);
});
- });
- */
- res.status(200).send('Demo data added (not)');
};