DenReg/registry/src/db.ts
Fabian Stamm 7da72872ba
All checks were successful
continuous-integration/drone/push Build is passing
Switching to owner instead of author
2020-08-03 09:38:01 +02:00

32 lines
587 B
TypeScript

import { Datastore } from "./deps.ts";
import { FS } from "./deps.ts";
await FS.ensureDir("./data");
export interface IPackage {
name: string;
owner: string;
description: string;
versions: string[];
deprecated: boolean;
}
export interface IApiKey {
user: string;
key: string;
createdAt: Date;
lastAccess?: Date;
lastIP?: string;
}
const db = {
package: new Datastore<IPackage>({
filename: "data/packages.json",
autoload: true,
}),
api_key: new Datastore<IApiKey>({
filename: "data/api_keys.json",
}),
};
export default db;