stringify json?
This commit is contained in:
parent
b37d5933a7
commit
7fec78ff84
@ -1,9 +1,7 @@
|
||||
// Database Access Layer stuff goes here
|
||||
|
||||
// Database Access Layer stuff goes here
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { db, sql } from "../../database/db"
|
||||
import { JsonValue } from '@firebox/tsutil';
|
||||
import { db, sql } from "../../database/db";
|
||||
import { PicobookManifest } from '../types';
|
||||
|
||||
export type DbRelease = {
|
||||
@ -78,12 +76,13 @@ export const getRelease = async (where: {
|
||||
|
||||
export const insertRelease = async (props: {manifest: PicobookManifest, carts: {name: string; rom: number[]}[]}) => {
|
||||
const {manifest, carts} = props;
|
||||
console.log('carts', JSON.stringify(carts));
|
||||
const {id: slug, author, repo, version} = manifest;
|
||||
const id = uuidv4();
|
||||
const now = new Date();
|
||||
await db.query(sql`
|
||||
INSERT INTO releases (id, slug, repo, version, author, carts, manifest, created_at)
|
||||
VALUES (${id}, ${slug}, ${repo}, ${version}, ${author}, ${carts}, ${manifest}, ${now})
|
||||
VALUES (${id}, ${slug}, ${repo}, ${version}, ${author}, ${JSON.stringify(carts)}, ${manifest}, ${now})
|
||||
`);
|
||||
return id;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user