Implement database administration
Add routes and admin panel elements for creating a database backup, restoring from a backup, deleting the existing schedule, and replacing the database with the demo schedule. These server as crude ways to manage the data stored in the system.
This commit is contained in:
parent
b2f48e98e0
commit
e5e923bc8d
6 changed files with 190 additions and 5 deletions
11
server/api/admin/delete-schedule.post.ts
Normal file
11
server/api/admin/delete-schedule.post.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { writeSchedule } from "~/server/database";
|
||||
import type { ApiSchedule } from "~/shared/types/api";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
await requireServerSessionWithAdmin(event);
|
||||
const schedule: ApiSchedule = {
|
||||
id: 111,
|
||||
updatedAt: new Date().toISOString(),
|
||||
};
|
||||
await writeSchedule(schedule);
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue