DenReg/registry/src/db.ts
Fabian Stamm c9bd5c7d18
All checks were successful
continuous-integration/drone/push Build is passing
Adding support for readme field in meta.json to registry
2020-10-19 21:10:53 +02:00

33 lines
606 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;
readme: string;
}
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;