Fix routing.
This commit is contained in:
52
src/routes/dev/setDemoData.ts
Normal file
52
src/routes/dev/setDemoData.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import { Request, Response } from 'express';
|
||||
import { prisma } from '../../index.js';
|
||||
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({
|
||||
data: {
|
||||
name: 'Test Storage Location',
|
||||
StorageBuilding: {
|
||||
connect: {
|
||||
id: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}).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);
|
||||
});
|
||||
});
|
||||
});
|
||||
*/
|
||||
res.send('Demo data added (not)');
|
||||
};
|
Reference in New Issue
Block a user