Skip to content

Commit

Permalink
Added ministries to plans
Browse files Browse the repository at this point in the history
  • Loading branch information
jzongker committed Apr 5, 2024
1 parent 525c295 commit 9143f77
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/models/Plan.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export class Plan {
public id?: string;
public churchId?: string;
public ministryId?: string;
public name?: string;
public serviceDate?: Date;
public notes?: string;
Expand Down
8 changes: 4 additions & 4 deletions src/repositories/PlanRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ export class PlanRepository {
private async create(plan: Plan) {
plan.id = UniqueIdHelper.shortId();

const sql = "INSERT INTO plans (id, churchId, name, serviceDate, notes) VALUES (?, ?, ?, ?, ?);";
const params = [plan.id, plan.churchId, plan.name, plan.serviceDate, plan.notes];
const sql = "INSERT INTO plans (id, churchId, ministryId, name, serviceDate, notes) VALUES (?, ?, ?, ?, ?, ?);";
const params = [plan.id, plan.churchId, plan.ministryId, plan.name, plan.serviceDate, plan.notes];
await DB.query(sql, params);
return plan;
}

private async update(plan: Plan) {
const sql = "UPDATE plans SET name=?, serviceDate=?, notes=? WHERE id=? and churchId=?";
const params = [plan.name, plan.serviceDate, plan.notes, plan.id, plan.churchId];
const sql = "UPDATE plans SET ministryId=?, name=?, serviceDate=?, notes=? WHERE id=? and churchId=?";
const params = [plan.ministryId, plan.name, plan.serviceDate, plan.notes, plan.id, plan.churchId];
await DB.query(sql, params);
return plan;
}
Expand Down
1 change: 1 addition & 0 deletions tools/dbScripts/plans.mysql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CREATE TABLE `plans` (
`id` char(11) NOT NULL,
`churchId` char(11) DEFAULT NULL,
`ministryId` char(11) DEFAULT NULL,
`name` varchar(45) DEFAULT NULL,
`serviceDate` date DEFAULT NULL,
`notes` text,
Expand Down

0 comments on commit 9143f77

Please sign in to comment.