Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pending field dependency for TEC #575

Merged
merged 3 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
2 changes: 1 addition & 1 deletion backend/src/API/teamEventsAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const requestTeamEventCredit = async (
`User with email ${user.email} cannot request team event credit for another member, ${request.member.email}.`
);
}
const updatedteamEvent = { ...request, pending: true, status: 'pending' as Status };
const updatedteamEvent = { ...request, status: 'pending' as Status };
const teamEventAttendance = await teamEventAttendanceDao.createTeamEventAttendance(
updatedteamEvent
);
Expand Down
1 change: 0 additions & 1 deletion backend/src/dao/TeamEventAttendanceDao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export default class TeamEventAttendanceDao extends BaseDao<
): Promise<TeamEventAttendance> {
const teamEventAttendanceWithUUID = {
...teamEventAttendance,
pending: true,
status: 'pending' as Status,
uuid: teamEventAttendance.uuid ? teamEventAttendance.uuid : uuidv4()
};
Expand Down
2 changes: 1 addition & 1 deletion backend/src/types/DataTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type DBTeamEventAttendance = {
hoursAttended?: number;
image: string;
eventUuid: string;
pending: boolean;
pending?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll be ok to remove this field entirely, since we're not using it. Note that even if the data in the database has this field, you won't have a "type error" due to extra fields that the type doesn't have.

status: Status;
reason: string;
uuid: string;
Expand Down
2 changes: 1 addition & 1 deletion common-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ interface TeamEventAttendance {
hoursAttended?: number;
image: string;
readonly eventUuid: string;
readonly pending: boolean;
readonly pending?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here as well, feel free to remove this field entirely, since we've fully migrated over to the status field.

readonly status: Status;
readonly reason: string;
readonly uuid: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const TeamEventCreditReview = (props: {
const approveCreditRequest = (teamEventAttendance: TeamEventAttendance) => {
const updatedTeamEventAttendance = {
...teamEventAttendance,
pending: false,
status: 'approved' as Status,
reason
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const TeamEventCreditForm: React.FC = () => {
hoursAttended: teamEvent.hasHours ? Number(hours) : undefined,
image: `eventProofs/${getNetIDFromEmail(userInfo.email)}/${new Date().toISOString()}`,
eventUuid: teamEvent.uuid,
pending: true,
status: 'pending' as Status,
reason: '',
uuid: ''
Expand Down
Loading