Skip to content

Commit

Permalink
Merge pull request #5 from ezequielramos/main
Browse files Browse the repository at this point in the history
adding active field on card human
  • Loading branch information
ezequielramos authored Apr 24, 2024
2 parents e9bfb7c + 267f11a commit 37092f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/controllers/humans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ interface Human {
name: string;
comment: string;
watch_lists: number[];
meta: { [key: string]: unknown };
meta: { [key: string]: unknown; };
active_after: null;
active_before: null;
disable_schedule: { [key: string]: unknown };
disable_schedule: { [key: string]: unknown; };
recount_schedule_on: null;
face_objects: number;
body_objects: number;
face_cluster: number | null;
body_cluster: number | null;
links_to_relations: { id: number, name: string, created_date: Date, card: number, relation: number }[];
links_to_relations: { id: number, name: string, created_date: Date, card: number, relation: number; }[];
}

let humanId = 0;
const humans: { [humanId: number]: Human | undefined } = {};
const humans: { [humanId: number]: Human | undefined; } = {};

function createHuman({ name }: { name: string }) {
function createHuman({ name, active }: { name: string; active: boolean; }) {
humanId++;
const human: Human = {
"id": humanId,
"active": true,
"active": active,
"filled": true,
"created_date": new Date(),
"modified_date": new Date(),
Expand Down
7 changes: 6 additions & 1 deletion src/routes/cards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ function loadCardRoutes(app: Express) {
}

const human = createHuman({
name: req.body.name
name: req.body.name,
active: req.body.active ?? true
});

return res.status(200).json(human);
Expand All @@ -85,6 +86,10 @@ function loadCardRoutes(app: Express) {
human.name = req.body.name;
}

if (req.body.active) {
human.active = req.body.active;
}

return res.status(200).json(human);

});
Expand Down

0 comments on commit 37092f1

Please sign in to comment.