Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
94eb93a
update schema
applepie7864 Nov 10, 2025
2048748
fix seeding data
applepie7864 Nov 10, 2025
61b356a
align resolvers with schema (1/2)
applepie7864 Nov 11, 2025
05ac0f0
earning goal endpoints
applepie7864 Nov 11, 2025
b599869
partial refactor of backend
applepie7864 Nov 12, 2025
024a6e1
notified field added, added resolver to query all unnotified badges
AnneSun1 Nov 12, 2025
638d0d9
Get Achieved Badge Levels (not notified)
Nov 12, 2025
db446e9
align backend with schema
applepie7864 Nov 12, 2025
8d68cd5
fix seed
applepie7864 Nov 12, 2025
56717ac
add fk to gql type defs
applepie7864 Nov 12, 2025
c3e119b
merge conflicts
applepie7864 Nov 12, 2025
247b393
Merge pull request #306 from uwblueprint/get_achieved_badge_levels
applepie7864 Nov 12, 2025
cb274a1
merge conflicts
applepie7864 Nov 12, 2025
9957ee0
Merge pull request #307 from uwblueprint/305-badge-notifs
applepie7864 Nov 12, 2025
c79a484
bulk upload of svg icons as static files
applepie7864 Nov 13, 2025
b82c4fd
add in icon definitions
applepie7864 Nov 13, 2025
6fba1ad
update requests
applepie7864 Nov 13, 2025
0546cb5
added remaining todos for backend
applepie7864 Nov 13, 2025
4cf95f3
define context/provider + fix login
applepie7864 Nov 13, 2025
1b22117
save progress
applepie7864 Nov 13, 2025
f7ce8d3
move into refactor folder
applepie7864 Nov 13, 2025
3389ce7
frontend todos
applepie7864 Nov 13, 2025
f862a3f
added todo comments for mehul & victor
applepie7864 Nov 14, 2025
28e0696
inline todo comments for calista
applepie7864 Nov 14, 2025
d07134b
inline todo comment for navraj
applepie7864 Nov 14, 2025
e162d4f
inline todo comment for yan
applepie7864 Nov 14, 2025
e2ee24a
updated resolvers for perfect badge (optional + required)
Nov 15, 2025
6101331
fetch participant data on route mount and store in context
yanxue06 Nov 15, 2025
b9afe94
admin context
yanxue06 Nov 15, 2025
5672323
generalized ui components for buttons, inputs & container
applepie7864 Nov 15, 2025
668a2db
save progress
applepie7864 Nov 15, 2025
082f2ef
move loading into useEffects
applepie7864 Nov 15, 2025
8034aae
merge conflicts
applepie7864 Nov 15, 2025
f288380
Merge pull request #311 from uwblueprint/yan/set-context-&-create-res…
applepie7864 Nov 15, 2025
df08833
add date-fns library
applepie7864 Nov 16, 2025
84a35da
Merge branch 'annie/schema_refactor' into victor/perfect_score_badge_…
applepie7864 Nov 16, 2025
32a37fe
Merge pull request #309 from uwblueprint/victor/perfect_score_badge_s…
applepie7864 Nov 16, 2025
5a0bba8
edit home page api calls
applepie7864 Nov 16, 2025
63ffbcf
additional ticket instructions
applepie7864 Nov 16, 2025
e89419c
fix date time offset
applepie7864 Nov 16, 2025
9a1f84b
track and award PR_LEADER_BADGE
yanxue06 Nov 17, 2025
3e79fd2
define ui component library
applepie7864 Nov 17, 2025
cf6ea19
marked tasks
applepie7864 Nov 17, 2025
d1786e0
resolve conflict
applepie7864 Nov 17, 2025
fb6a2cd
remove return statement
applepie7864 Nov 17, 2025
f60b4ed
Merge pull request #312 from uwblueprint/yan/leader-badge-logic
applepie7864 Nov 17, 2025
ff83209
creates a badge level progress object for each level
yanxue06 Nov 19, 2025
f5d247c
merged stashed change with new format changes
NavrajBal Nov 19, 2025
e50a05a
save progress
applepie7864 Nov 19, 2025
c2d1fc9
Merge pull request #337 from uwblueprint/yan/pr-leader-badge-init
applepie7864 Nov 19, 2025
abb1098
Merge pull request #338 from uwblueprint/325-format-date-time
applepie7864 Nov 19, 2025
2793a7b
add toggle button
jennifershi255 Nov 19, 2025
fd32783
Merge remote-tracking branch 'origin/annie/schema_refactor' into anni…
applepie7864 Nov 19, 2025
e2b4785
colored widget component
applepie7864 Nov 19, 2025
20340ec
displays added
AnneSun1 Nov 19, 2025
e2b47de
remove dark bg around checkmark
AnneSun1 Nov 19, 2025
4e13279
resize icons
AnneSun1 Nov 19, 2025
35426be
decrease toggle size
applepie7864 Nov 19, 2025
00d23c8
Merge pull request #340 from uwblueprint/335-toggle-component
applepie7864 Nov 19, 2025
2ccd34a
add task status to ui page + minimize size
applepie7864 Nov 19, 2025
60e9f46
resolve conflict
applepie7864 Nov 19, 2025
7587b17
Merge pull request #339 from uwblueprint/329/task-status-display-comp…
applepie7864 Nov 19, 2025
a42ef21
pain
Nov 19, 2025
c15bc74
set tid as a required field
applepie7864 Nov 20, 2025
4608565
update frontend endpoint
applepie7864 Nov 20, 2025
a0866ea
Merge pull request #341 from uwblueprint/badge_logic
applepie7864 Nov 20, 2025
57b16a1
fetch badge progression by pid
applepie7864 Nov 20, 2025
502a7e4
missing value input for earned badge creation resolver
applepie7864 Nov 20, 2025
418dc0d
only record progress upon first login of the day
applepie7864 Nov 20, 2025
d8b3075
assign to all participants upon creation of required task
applepie7864 Nov 20, 2025
ecdc2dd
update context with pid/role
applepie7864 Nov 21, 2025
efef72b
update get today to be announcements less than eod today
NavrajBal Nov 21, 2025
9b9e08e
refactored admin login page
applepie7864 Nov 21, 2025
b86f36c
Merge remote-tracking branch 'origin/annie/schema_refactor' into anni…
applepie7864 Nov 21, 2025
f8797eb
revert announcement date
applepie7864 Nov 21, 2025
5c32ba7
refactor badges
jennifershi255 Nov 21, 2025
9ef1e32
participant login ui refactor
applepie7864 Nov 21, 2025
541790d
pain
Nov 21, 2025
1807316
refactor badges
jennifershi255 Nov 21, 2025
d6b2770
refactoring
jennifershi255 Nov 26, 2025
b2ad9ae
fixing bugs
jennifershi255 Nov 26, 2025
a624ec1
fix errors
jennifershi255 Nov 27, 2025
167f7c8
using notfication hook
jennifershi255 Nov 28, 2025
5d501fd
reformatted home page
Nov 28, 2025
87a91d3
badge components refactored
applepie7864 Dec 20, 2025
fbda44d
fix merge conflicts
applepie7864 Dec 20, 2025
80fa731
fix errors
applepie7864 Dec 20, 2025
d3306fa
fix additional merge conflicts
applepie7864 Dec 20, 2025
4e8b394
Merge pull request #349 from uwblueprint/refactor-badges-page
applepie7864 Dec 20, 2025
cb7dbe4
merge changes
applepie7864 Dec 21, 2025
f0dcf79
Merge pull request #347 from uwblueprint/victor/refactor_admin_home_page
applepie7864 Dec 21, 2025
551e00c
merge
applepie7864 Dec 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
- [ ] All of my containers are healthy and not producing any error messages
- [ ] The frontend and backend ports are set to 3000 & 5000, respectively
- [ ] If new packages were installed, I ran yarn install, and there is no package-lock.json file present in the codebase
- [ ] I took note of any changes made outside of my ticket (e.g. refactored common ui component, updated an endpoint, changed the schema, etc.)
2 changes: 2 additions & 0 deletions RAILWAY_DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,5 @@ Railway respects the ENTRYPOINT, so both environments run `prismaInitAndRun` on
```
4. **Monitor Railway logs** on deployment to verify seeding behavior
5. **Keep system badges in sync** between `prodData.ts` and production database

TODO: Review & update doc
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ Backend: http://localhost:5000/graphql

## Database Interactions
Apply / migrate changes in prisma.schema to the database:
1. Change the DATABASE_URL in the backend .env file to: postgresql://postgres:postgres@**localhost**:5432/mp
2. In your terminal, run `npx prisma migrate dev` in the backend folder and follow the prompts
3. Don’t forget to reset DATABASE_URL back to postgresql://postgres:postgres@**mp_db**:5432/mp
1. First ensure your `mp_db` container is running
2. Change the DATABASE_URL in the backend .env file to: postgresql://postgres:postgres@**localhost**:5432/mp
3. In your terminal, run `npx prisma migrate dev` in the backend folder and follow the prompts
4. Don’t forget to reset DATABASE_URL back to postgresql://postgres:postgres@**mp_db**:5432/mp

Common database commands:
```bash
Expand Down
2 changes: 2 additions & 0 deletions backend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module.exports = {
"class-methods-use-this": 0,
"import/prefer-default-export": "off",
"no-console": "off",
"import/no-cycle": "off",
"@typescript-eslint/no-explicit-any": "off",
},
ignorePatterns: ["build/*"],
};
4 changes: 1 addition & 3 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ WORKDIR /app
COPY . ./
RUN apt-get update -y && apt-get install -y openssl
RUN yarn install
ARG NODE_ENV
ENV NODE_ENV=$NODE_ENV
EXPOSE 5000
ENTRYPOINT ["yarn", "prismaInitAndRun"]
ENTRYPOINT ["yarn", "start"]
11 changes: 11 additions & 0 deletions backend/constants/days.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { DayOfWeek } from "@prisma/client";

export const orderedDays = [
DayOfWeek.SUNDAY,
DayOfWeek.MONDAY,
DayOfWeek.TUESDAY,
DayOfWeek.WEDNESDAY,
DayOfWeek.THURSDAY,
DayOfWeek.FRIDAY,
DayOfWeek.SATURDAY,
];
3 changes: 3 additions & 0 deletions backend/constants/roles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const ADMIN = "admin";
export const RELIEF = "relief";
export const PARTICIPANT = "participant";
19 changes: 19 additions & 0 deletions backend/constants/systemBadges.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const LOGIN = "Log In";
export const PERFECT_SCORE_REQUIRED = "Perfect Score (Required Tasks)";
export const PERFECT_SCORE_OPTIONAL = "Perfect Score (Optional Tasks)";
export const MONEY_EARNED = "Money Earned Milestone";
export const PR_LEADER = "PR Leader";
export const INDIVIDUAL_GOAL = "Individual Goals Complete";
export const FIRST_GOAL = "First Goal Set";
export const JACK_OF_ALL_TRADES = "Jack of All Trades";

export const SYSTEM_BADGES = [
LOGIN,
PERFECT_SCORE_REQUIRED,
PERFECT_SCORE_OPTIONAL,
MONEY_EARNED,
PR_LEADER,
INDIVIDUAL_GOAL,
FIRST_GOAL,
JACK_OF_ALL_TRADES,
];
77 changes: 18 additions & 59 deletions backend/crons/index.ts
Original file line number Diff line number Diff line change
@@ -1,75 +1,34 @@
import cron from "node-cron";
import expireAdminNotes from "./scripts/expireAdminNotes";
import expireAdminAnnouncements from "./scripts/expireAdminAnnouncements";
import expireLoginStreak from "./scripts/expireLoginStreak";
import createAssignedTasks from "./scripts/createAssignedTask";
import {
sendWeeklyReports,
sendMonthlyReports,
} from "./scripts/sendReportEmails";
import { isLastDayOfMonth } from "date-fns";
import expireNotes from "./scripts/expireNotes";
import expireAnnouncements from "./scripts/expireAnnouncements";
import resetLoginStreak from "./scripts/resetLoginStreak";
import assignRequiredTasks from "./scripts/assignRequiredTasks";
import sendMonthlyReport from "./scripts/sendMonthlyReport";
import sendWeeklyReport from "./scripts/sendWeeklyReport";

cron.schedule("0 0 * * * *", async () => {
const res = await expireAdminNotes();
if (res) {
console.log("Deleted expired notes");
} else {
console.log("Could not expire admin notes");
}
await expireNotes();
});

cron.schedule("0 0 0 * * *", async () => {
const res = await expireAdminAnnouncements();
if (res) {
console.log("Expired admin announcements");
} else {
console.log("Could not expire admin announcements");
}
await expireAnnouncements();
});

cron.schedule("0 0 0 * * *", async () => {
const res = await expireLoginStreak();
if (res) {
console.log("Expired login streaks");
} else {
console.log("Could not expire login streaks");
}
cron.schedule("0 59 23 * * *", async () => {
await resetLoginStreak();
});

cron.schedule("0 0 * * 1", async () => {
const res = await createAssignedTasks();
if (res) {
console.log("Created assigned tasks");
} else {
console.log("Could not create assigned tasks");
}
cron.schedule("0 0 0 * * 0", async () => {
await assignRequiredTasks();
});

// Weekly reports - every Monday at 9 AM
cron.schedule("0 9 * * 1", async () => {
const timestamp = new Date().toISOString();
console.log(
`[${timestamp}] Starting weekly report generation and emailing...`
);

const res = await sendWeeklyReports();
if (res) {
console.log(`[${timestamp}] Weekly reports sent successfully`);
} else {
console.log(`[${timestamp}] Could not send weekly reports`);
}
cron.schedule("0 0 23 * * 6", async () => {
await sendWeeklyReport();
});

// Monthly reports - first day of month at 9 AM
cron.schedule("0 9 1 * *", async () => {
const timestamp = new Date().toISOString();
console.log(
`[${timestamp}] Starting monthly report generation and emailing...`
);

const res = await sendMonthlyReports();
if (res) {
console.log(`[${timestamp}] Monthly reports sent successfully`);
} else {
console.log(`[${timestamp}] Could not send monthly reports`);
cron.schedule("0 0 23 * * *", async () => {
if (isLastDayOfMonth(new Date())) {
await sendMonthlyReport();
}
});
18 changes: 18 additions & 0 deletions backend/crons/scripts/assignRequiredTasks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Task, TaskType } from "@prisma/client";
import db from "../../prisma";
import { assignTasksToAllParticipants } from "../../utils/taskUtils";

// assigns all required tasks to each participant for the current week
async function assignRequiredTasks() {
try {
const requiredTasks: Task[] = await db.task.findMany({
where: { type: TaskType.REQUIRED },
});
assignTasksToAllParticipants(requiredTasks);
console.log("successfully assigned required tasks to participants");
} catch (err) {
console.error(err);
}
}

export default assignRequiredTasks;
130 changes: 0 additions & 130 deletions backend/crons/scripts/createAssignedTask.ts

This file was deleted.

22 changes: 0 additions & 22 deletions backend/crons/scripts/expireAdminAnnouncements.ts

This file was deleted.

22 changes: 0 additions & 22 deletions backend/crons/scripts/expireAdminNotes.ts

This file was deleted.

17 changes: 17 additions & 0 deletions backend/crons/scripts/expireAnnouncements.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { subDays, startOfDay } from "date-fns";
import prisma from "../../prisma";

// deletes announcements that are older than 7 days ago
async function expireAnnouncements() {
const sevenDaysAgo = subDays(startOfDay(new Date()), 7);
try {
await prisma.announcement.deleteMany({
where: { date: { lt: sevenDaysAgo } },
});
console.log("successfully expired announcements");
} catch (err) {
console.error(err);
}
}

export default expireAnnouncements;
Loading
Loading