From 755e849ded70fca2ef095a4fa59048d96d36e50d Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Mon, 12 Oct 2020 20:33:18 +0300 Subject: [PATCH] add (empty) photos routes --- src/app.ts | 2 ++ src/entity/Photo.ts | 17 +++++++++++++++++ src/routes/photos.ts | 3 +++ 3 files changed, 22 insertions(+) create mode 100644 src/entity/Photo.ts create mode 100644 src/routes/photos.ts diff --git a/src/app.ts b/src/app.ts index b6a465d..b21e670 100644 --- a/src/app.ts +++ b/src/app.ts @@ -12,6 +12,7 @@ import * as serve from "koa-static"; import { config, EnvType } from "~config"; import { userRouter } from "~routes/users"; import { devRouter } from "~routes/dev"; +import { photosRouter } from "~routes/photos"; export const app = new Koa(); @@ -45,6 +46,7 @@ app.use(async (ctx, next) => { app.use(serve("frontend/dist")); app.use(userRouter.routes()).use(userRouter.allowedMethods()); +app.use(photosRouter.routes()).use(photosRouter.allowedMethods()); if (config.env === EnvType.development) { app.use(devRouter.routes()).use(devRouter.allowedMethods()); diff --git a/src/entity/Photo.ts b/src/entity/Photo.ts new file mode 100644 index 0000000..3016deb --- /dev/null +++ b/src/entity/Photo.ts @@ -0,0 +1,17 @@ +import { + BaseEntity, + Column, + Entity, + Index, + PrimaryGeneratedColumn, +} from "typeorm"; + +@Entity() +export class Photo extends BaseEntity { + @PrimaryGeneratedColumn() + public id: number; + + @Column({ length: 190 }) + @Index() + public hash: string; +} diff --git a/src/routes/photos.ts b/src/routes/photos.ts new file mode 100644 index 0000000..f38cbb3 --- /dev/null +++ b/src/routes/photos.ts @@ -0,0 +1,3 @@ +import * as Router from "koa-router"; + +export const photosRouter = new Router();