Skip to content

Commit f41cfd9

Browse files
committed
removed clean up bc users can end it themselves, added testing
1 parent 1b9a306 commit f41cfd9

4 files changed

Lines changed: 549 additions & 20 deletions

File tree

src/backend/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import financeRouter from './src/routes/finance.routes.js';
2828
import calendarRouter from './src/routes/calendar.routes.js';
2929
import prospectiveSponsorRouter from './src/routes/prospective-sponsor.routes.js';
3030
import attendanceRouter from './src/routes/attendance.routes.js';
31-
import AttendanceService from './src/services/attendance.services.js';
3231

3332
const app = express();
3433

@@ -124,7 +123,6 @@ app.use(errorHandler);
124123

125124
// start the server
126125
app.listen(port, () => {
127-
AttendanceService.cleanupStaleAttendances().catch((err) => console.error('Failed to cleanup stale attendances:', err));
128126
console.log(
129127
`FinishLine listening at http://localhost:${port}. Currently running in ${isProd ? 'production' : 'development'} mode.`
130128
);

src/backend/src/services/attendance.services.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ export default class AttendanceService {
102102
attendees: { connect: { userId: userWithSettings.userId } }
103103
}
104104
});
105-
106-
console.log(`Attendance recorded: ${userWithSettings.firstName} ${userWithSettings.lastName} (${slackUserId})`);
107105
}
108106

109107
static async closeAttendance(meetingAttendanceId: string): Promise<void> {
@@ -142,20 +140,6 @@ export default class AttendanceService {
142140
});
143141
}
144142

145-
static async cleanupStaleAttendances(organizationId?: string): Promise<void> {
146-
const oneHourAgo = new Date(Date.now() - 3600000);
147-
148-
const staleAttendances = await prisma.meeting_Attendance.findMany({
149-
where: {
150-
closedAt: null,
151-
openedAt: { lt: oneHourAgo },
152-
...(organizationId ? { organizationId } : {})
153-
}
154-
});
155-
156-
await Promise.all(staleAttendances.map((a) => AttendanceService.closeAttendance(a.meetingAttendanceId)));
157-
}
158-
159143
static async getOngoingAttendance(teamId: string, organization: Organization): Promise<MeetingAttendance | null> {
160144
const team = await prisma.team.findUnique({ where: { teamId } });
161145

@@ -174,8 +158,6 @@ export default class AttendanceService {
174158
static async closeOngoingAttendance(teamId: string, submitter: User, organization: Organization): Promise<void> {
175159
const team = await prisma.team.findUnique({ where: { teamId } });
176160

177-
console.log(submitter);
178-
179161
if (!team || team.organizationId !== organization.organizationId) {
180162
throw new NotFoundException('Team', teamId);
181163
}

src/backend/tests/test-utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export const resetUsers = async () => {
122122
await prisma.manufacturer.deleteMany();
123123
await prisma.material_Type.deleteMany();
124124
await prisma.assembly.deleteMany();
125+
await prisma.meeting_Attendance.deleteMany();
125126
await prisma.team.deleteMany();
126127
await prisma.user_Secure_Settings.deleteMany();
127128
await prisma.receipt.deleteMany();
@@ -177,6 +178,8 @@ export const resetUsers = async () => {
177178
await prisma.shop_Machinery.deleteMany();
178179
await prisma.machinery.deleteMany();
179180
await prisma.shop.deleteMany();
181+
await prisma.description_Bullet.deleteMany();
182+
await prisma.description_Bullet_Type.deleteMany();
180183
await prisma.organization.deleteMany();
181184
await prisma.user.deleteMany();
182185
};

0 commit comments

Comments
 (0)