Skip to content

Commit

Permalink
Revert changes after las release (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
paularintaharri authored Mar 29, 2023
1 parent 2d4c7e0 commit 78b6fc3
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 594 deletions.
45 changes: 0 additions & 45 deletions migrations/1671010308952_create-agegroup-completed-table.js

This file was deleted.

49 changes: 0 additions & 49 deletions src/database/ageGroups.js

This file was deleted.

12 changes: 0 additions & 12 deletions src/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
getGroupMembers,
} from './kuksa'
import { getTaskEntries, getTaskGroupEntries } from './database'
import { getAgeGroupEntries } from './database/ageGroups'

async function getMemberData(groupMembers) {
return Promise.all(
Expand All @@ -14,9 +13,6 @@ async function getMemberData(groupMembers) {
const allMemberTaskGroupEntries = await getTaskGroupEntries(
groupMember.id.id
)
const allMemberAgeGroupEntries = await getAgeGroupEntries(
groupMember.id.id
)
const taskEntries = allMemberTaskEntries.reduce((acc, task) => {
acc[task.task_guid] = task.completion_status
return acc
Expand All @@ -28,13 +24,6 @@ async function getMemberData(groupMembers) {
},
{}
)
const ageGroupEntries = allMemberAgeGroupEntries.reduce(
(acc, agegroup) => {
acc[agegroup.agegroup_guid] = agegroup.completion_status
return acc
},
{}
)
return Object.assign(
{},
{
Expand All @@ -44,7 +33,6 @@ async function getMemberData(groupMembers) {
groupMember.name.firstname + ' ' + groupMember.name.lastname,
memberTasks: taskEntries,
memberTaskGroups: taskgroupEntries,
memberAgeGroups: ageGroupEntries,
}
)
})
Expand Down
40 changes: 0 additions & 40 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import taskGroups from './taskGroups'
import { deleteOldNotifications } from './database/notifications'
import https from 'https'
import fs from 'fs'
import { postAgegroupEntry, getAgeGroupEntries } from './database/ageGroups'

require('dotenv').config()

Expand Down Expand Up @@ -160,45 +159,6 @@ const main = async () => {
})
})

app.post(
'/groups/mark-agegroup-done/:agegroup_guid',
isLoggedIn,
isGroupLeader,
async (req, res) => {
try {
const userData = req.body
const promises = Object.values(userData.groups).map((userIds) => {
const promises = userIds.map((user_guid) =>
Promise.resolve(
postAgegroupEntry({
user_guid: Number(user_guid),
created_by: Number(req.user.membernumber),
agegroup_guid: req.params.agegroup_guid,
completed: 'COMPLETED',
group_leader_name: userData.group_leader_name,
})
)
)
return promises
})
const iterablePromises = [].concat.apply([], promises)
const entries = await Promise.all(iterablePromises)
res.json(entries).status(200)
} catch (e) {
res.status(e.statusCode).send(e.message)
}
}
)

app.get('/agegroup-entries', isLoggedIn, async (req, res) => {
try {
const entries = await getAgeGroupEntries(req.user.membernumber)
res.json(entries).status(200)
} catch (e) {
res.status(e.statusCode).send(e.message)
}
})

app.post('/task-entry', isLoggedIn, async (req, res) => {
try {
const data = req.body
Expand Down
35 changes: 0 additions & 35 deletions src/scripts/delete-activities-by-id.js

This file was deleted.

106 changes: 0 additions & 106 deletions src/scripts/get-unused-activities.js

This file was deleted.

Loading

0 comments on commit 78b6fc3

Please sign in to comment.