add (empty) photos routes

This commit is contained in:
2020-10-12 20:33:18 +03:00
committed by Stepan Usatiuk
parent a8b5117979
commit 755e849ded
3 changed files with 22 additions and 0 deletions

View File

@@ -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());

17
src/entity/Photo.ts Normal file
View File

@@ -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;
}

3
src/routes/photos.ts Normal file
View File

@@ -0,0 +1,3 @@
import * as Router from "koa-router";
export const photosRouter = new Router();