diff --git a/src/apiBase b/src/apiBase index 510d355..509bbba 160000 --- a/src/apiBase +++ b/src/apiBase @@ -1 +1 @@ -Subproject commit 510d355294b0c67710455f71adcf73598938daa2 +Subproject commit 509bbbafaf2626d64daec99f989e430a4b694ada diff --git a/src/controllers/ChurchController.ts b/src/controllers/ChurchController.ts deleted file mode 100644 index cc93ffb..0000000 --- a/src/controllers/ChurchController.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { controller, httpPost } from "inversify-express-utils"; -import { UserInterface, ChurchInterface } from "../helpers"; -import express from "express"; -import { AttendanceBaseController } from "./AttendanceBaseController"; - -@controller("/churches") -export class ChurchController extends AttendanceBaseController { - - async validateInit(churchId: string) { - const errors = []; - const campuses = await this.repositories.campus.loadAll(churchId); - if (campuses.length > 0) errors.push("Church already initialized"); - return errors; - } - - @httpPost("/init") - public async init(req: express.Request, res: express.Response): Promise { - return this.actionWrapper(req, res, async (au) => { - const errors = await this.validateInit(au.churchId); - if (errors.length > 0) return this.denyAccess(errors); - else { - const campus = await this.repositories.campus.save({ churchId: au.churchId, name: "Main Campus" }); - const service = await this.repositories.service.save({ churchId: au.churchId, campusId: campus.id, name: "Sunday Morning" }); - await this.repositories.serviceTime.save({ churchId: au.churchId, serviceId: service.id, name: "09:00am" }); - return {}; - } - - }); - } -} diff --git a/src/controllers/index.ts b/src/controllers/index.ts index 4961dc8..ec3d025 100644 --- a/src/controllers/index.ts +++ b/src/controllers/index.ts @@ -2,7 +2,6 @@ export { CustomBaseController, ErrorController, NoteController, } from "../apiBa export { AttendanceRecordController } from "./AttendanceRecordController"; export { CampusController } from "./CampusController"; -export { ChurchController } from "./ChurchController"; export { GroupServiceTimeController } from "./GroupServiceTimeController"; export { ServiceController } from "./ServiceController"; export { ServiceTimeController } from "./ServiceTimeController"; diff --git a/src/helpers/index.ts b/src/helpers/index.ts index c1a6c20..fed65b2 100644 --- a/src/helpers/index.ts +++ b/src/helpers/index.ts @@ -1,2 +1,2 @@ -export { ArrayHelper, ChurchInterface, UserInterface, DateTimeHelper, UniqueIdHelper } from "../apiBase/helpers"; +export { ArrayHelper, DateTimeHelper, UniqueIdHelper } from "../apiBase/helpers"; export * from "./Permissions"; \ No newline at end of file