- migrated old page to new partials
- fixed setDemoData endpoint
This commit is contained in:
parent
5a21e56e80
commit
58a36d36ec
@ -34,8 +34,8 @@ model Item {
|
|||||||
manufacturer String
|
manufacturer String
|
||||||
category Category
|
category Category
|
||||||
status Status
|
status Status
|
||||||
StorageLocation StorageLocation @relation(fields: [storageLocationId], references: [id])
|
StorageLocation StorageLocation? @relation(fields: [storageLocationId], references: [id])
|
||||||
storageLocationId Int
|
storageLocationId Int?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
}
|
}
|
||||||
@ -43,8 +43,8 @@ model Item {
|
|||||||
model StorageLocation {
|
model StorageLocation {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
name String
|
name String
|
||||||
storageBuilding StorageBuilding @relation(fields: [storageBuildingId], references: [id])
|
storageBuilding StorageBuilding? @relation(fields: [storageBuildingId], references: [id])
|
||||||
storageBuildingId Int
|
storageBuildingId Int?
|
||||||
Item Item[]
|
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">
|
<div class="alert alert-primary" role="alert">
|
||||||
A simple primary alert—check it out!
|
A simple primary alert—check it out!
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<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="description" content="A simple HTML5 Template for new projects." />
|
||||||
<meta name="author" content="[Project-Name-Here]" />
|
<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">
|
<div class="ui raised very padded text container segment">
|
||||||
<h2 class="ui header"><%= it.name %></h2>
|
<h2 class="ui header"><%= it.name %></h2>
|
||||||
<p><strong>Category:</strong> <%= it.category%></p>
|
<p><strong>Category:</strong> <%= it.category%></p>
|
||||||
@ -27,5 +8,5 @@
|
|||||||
<p><strong>Comment:</strong> <%= it.comment %></p>
|
<p><strong>Comment:</strong> <%= it.comment %></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
<%~ E.includeFile("foot.eta.html") %>
|
@ -1,28 +1,10 @@
|
|||||||
import { Request, Response } from 'express';
|
import { Request, Response } from 'express';
|
||||||
import { prisma } from '../../index.js';
|
import { prisma } from '../../index.js';
|
||||||
|
import { Status, Category } from '@prisma/client';
|
||||||
|
|
||||||
export default (req: Request, res: Response) => {
|
export default (req: Request, res: Response) => {
|
||||||
/*
|
|
||||||
// fill database with demo data
|
// 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({
|
|
||||||
data: {
|
|
||||||
name: 'Test Storage Location',
|
|
||||||
StorageBuilding: {
|
|
||||||
connect: {
|
|
||||||
id: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).then(() => {
|
|
||||||
prisma.item
|
prisma.item
|
||||||
.create({
|
.create({
|
||||||
data: {
|
data: {
|
||||||
@ -31,12 +13,7 @@ export default (req: Request, res: Response) => {
|
|||||||
name: 'Test Item',
|
name: 'Test Item',
|
||||||
manufacturer: 'Test Manufacturer',
|
manufacturer: 'Test Manufacturer',
|
||||||
category: Category.Other,
|
category: Category.Other,
|
||||||
status: Status.normal,
|
status: Status.normal
|
||||||
storageLocation: {
|
|
||||||
connect: {
|
|
||||||
id: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -45,8 +22,4 @@ export default (req: Request, res: Response) => {
|
|||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
res.send('Error adding demo data: ' + err);
|
res.send('Error adding demo data: ' + err);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
res.status(200).send('Demo data added (not)');
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user