- migrated old page to new partials
- fixed setDemoData endpoint
This commit is contained in:
		@@ -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[]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
<%~ E.includeFile("head.eta.html") %>
 | 
			
		||||
<%~ E.includeFile("head.eta.html", {"title": "Bootstrap Demo Page"}) %>
 | 
			
		||||
 | 
			
		||||
<div class="alert alert-primary" role="alert">
 | 
			
		||||
	A simple primary alert—check it out!
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
		<meta charset="utf-8" />
 | 
			
		||||
		<meta name="viewport" content="width=device-width, initial-scale=1" />
 | 
			
		||||
 | 
			
		||||
		<title>AssetFlow - Info about item</title>
 | 
			
		||||
		<title>AssetFlow - <%= it.title %></title>
 | 
			
		||||
		<meta name="description" content="A simple HTML5 Template for new projects." />
 | 
			
		||||
		<meta name="author" content="[Project-Name-Here]" />
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,24 +1,5 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<%~ E.includeFile("head.eta.html", {"title": "Item Info"}) %>
 | 
			
		||||
 | 
			
		||||
<html lang="en">
 | 
			
		||||
	<head>
 | 
			
		||||
		<meta charset="utf-8" />
 | 
			
		||||
		<meta name="viewport" content="width=device-width, initial-scale=1" />
 | 
			
		||||
 | 
			
		||||
		<title>AssetFlow - Info about item</title>
 | 
			
		||||
		<meta name="description" content="A simple HTML5 Template for new projects." />
 | 
			
		||||
		<meta name="author" content="[Project-Name-Here]" />
 | 
			
		||||
 | 
			
		||||
		<link rel="icon" href="/favicon.ico" />
 | 
			
		||||
		<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
 | 
			
		||||
 | 
			
		||||
		<script src="/static/jquery/dist/jquery.min.js"></script>
 | 
			
		||||
		<link href="/static/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
 | 
			
		||||
		<link href="/static/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
 | 
			
		||||
		<script src="/static/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
 | 
			
		||||
	</head>
 | 
			
		||||
 | 
			
		||||
	<body>
 | 
			
		||||
		<div class="ui raised very padded text container segment">
 | 
			
		||||
			<h2 class="ui header"><%= it.name %></h2>
 | 
			
		||||
			<p><strong>Category:</strong> <%= it.category%></p>
 | 
			
		||||
@@ -27,5 +8,5 @@
 | 
			
		||||
			<p><strong>Comment:</strong> <%= it.comment %></p>
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
	</body>
 | 
			
		||||
</html>
 | 
			
		||||
 | 
			
		||||
<%~ E.includeFile("foot.eta.html") %>
 | 
			
		||||
@@ -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)');
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user