work on db
This commit is contained in:
parent
0d97f40fc5
commit
8b987bc589
13
src/database/migrations/4-fourth-migration.sql
Normal file
13
src/database/migrations/4-fourth-migration.sql
Normal file
@ -0,0 +1,13 @@
|
||||
DROP TABLE repos;
|
||||
|
||||
DROP TABLE releases;
|
||||
|
||||
CREATE TABLE releases (
|
||||
id text,
|
||||
picobook_version int,
|
||||
repo text,
|
||||
slug text,
|
||||
version text,
|
||||
carts json,
|
||||
title text,
|
||||
);
|
@ -1,4 +1,5 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { TypeCompiler } from "@sinclair/typebox/compiler";
|
||||
import { FirRouteInput, FirRouteOptions } from "../util/routewrap";
|
||||
import {git} from "../util/git.ts";
|
||||
import { randomUUID } from "crypto";
|
||||
@ -13,9 +14,26 @@ const url = "/api/release";
|
||||
|
||||
const payloadT = Type.Any();
|
||||
|
||||
const manifestT = Type.Object({
|
||||
picobook_version: Type.Number(),
|
||||
id: Type.String(),
|
||||
version: Type.String(),
|
||||
carts: Type.Array(Type.String()),
|
||||
repo: Type.String(),
|
||||
title: Type.Optional(Type.String()),
|
||||
author: Type.Optional(Type.String()),
|
||||
readme: Type.Optional(Type.String()),
|
||||
});
|
||||
|
||||
const ManifestType = TypeCompiler.Compile(manifestT)
|
||||
|
||||
const handler = async ({payload}: FirRouteInput<typeof payloadT>) => {
|
||||
const {manifest, token} = payload;
|
||||
|
||||
if (!ManifestType.Check(manifest)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const uuid = randomUUID();
|
||||
const repoPath = path.join(reposPath, uuid);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user