Skip to content

Commit

Permalink
Update /user/application (#138)
Browse files Browse the repository at this point in the history
updated for new application
  • Loading branch information
pm3512 authored Dec 26, 2023
1 parent e9c4832 commit ddbf35e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 22 deletions.
11 changes: 6 additions & 5 deletions src/_types/Profile.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface IProfile extends Document {
event: ObjectId;
user: ObjectId;
firstName: string;
middleName?: string;
lastName: string;
displayName: string;
age: number;
Expand All @@ -24,20 +25,19 @@ export interface IProfile extends Document {
ethnicityOther?: string;
phoneNumber: string;
major?: string;
coursework?: string;
languages?: string;
courses?: string[];
programmingLanguages?: string[];
otherSkills?: string[];
hackathonExperience?: Profile.HackathonExperience;
workPermission?: Profile.WorkPermission;
workLocation?: string;
workStrengths?: string;
sponsorRanking?: ObjectId[];
resume?: string;
profilePicture?: string;
github: string;
design?: string;
website?: string;
essays?: string[];
dietaryRestrictions?: string;
dietaryRestrictions?: string[];
shirtSize?: Profile.ShirtSize;
wantsHardware?: boolean;
address?: string;
Expand All @@ -47,6 +47,7 @@ export interface IProfile extends Document {
updatedAt?: Date;
totalPoints: number;
attendingPhysically: boolean;
notes?: string;

team?: ITeam;

Expand Down
6 changes: 1 addition & 5 deletions src/controllers/ProfileController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ export const submitProfile = async (
delete profileArgs.resume;

// Filter out invalid object IDs in sponsor ranking
if (profileArgs.sponsorRanking) {
profileArgs.sponsorRanking = profileArgs.sponsorRanking.filter((id) =>
ObjectId.isValid(id)
);
}

// Check if user has uploaded a resume yet
const resumeExists = await hasResume(user._id);
Expand All @@ -148,6 +143,7 @@ export const submitProfile = async (
return bad(res, `Display name ${displayName} is taken!`);
}

console.log('upserting', profileArgs)
await Profile.findOneAndUpdate(
{ user: user._id, event: tartanhacks._id },
{
Expand Down
9 changes: 6 additions & 3 deletions src/models/Profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const Profile: Schema<IProfile> = new Schema(
required: true,
},
firstName: { type: String, required: true },
middleName: { type: String },
lastName: { type: String, required: true },
displayName: { type: String, required: true },
age: { type: Number },
Expand Down Expand Up @@ -108,8 +109,9 @@ const Profile: Schema<IProfile> = new Schema(
},
},
major: String,
coursework: String,
languages: String,
courses: Array<String>,
programmingLanguages: Array<String>,
otherSkills: Array<String>,
hackathonExperience: {
type: String,
enum: Object.values(HackathonExperience).concat([null]),
Expand All @@ -133,7 +135,7 @@ const Profile: Schema<IProfile> = new Schema(
design: String,
website: String,
essays: [String],
dietaryRestrictions: String,
dietaryRestrictions: Array<String>,
shirtSize: {
type: String,
enum: Object.values(ShirtSize).concat([null]),
Expand All @@ -150,6 +152,7 @@ const Profile: Schema<IProfile> = new Schema(
required: true,
default: false,
},
notes: String,
},
{
timestamps: {
Expand Down
28 changes: 19 additions & 9 deletions src/routes/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ router.get("/team", isAuthenticated, asyncCatch(getOwnTeam));
* enum: [Undergraduate, Masters, Doctorate, Other]
* graduationYear:
* type: integer
* minimum: 2022
* maximum: 2027
* minimum: 2023
* maximum: 2028
* required: true
* gender:
* type: string
Expand All @@ -160,10 +160,18 @@ router.get("/team", isAuthenticated, asyncCatch(getOwnTeam));
* validation: '^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$'
* major:
* type: string
* coursework:
* type: string
* languages:
* type: string
* courses:
* type: array
* items:
* type: string
* programmingLanguages:
* type: array
* items:
* type: string
* otherSkills:
* type: array
* items:
* type: string
* hackathonExperience:
* type: string
* enum: [0, 0-3, 4+]
Expand All @@ -174,8 +182,6 @@ router.get("/team", isAuthenticated, asyncCatch(getOwnTeam));
* type: string
* workStrengths:
* type: string
* sponsorRanking:
* type: array
* items:
* type: string
* github:
Expand All @@ -190,7 +196,9 @@ router.get("/team", isAuthenticated, asyncCatch(getOwnTeam));
* items:
* type: string
* dietaryRestrictions:
* type: string
* type: array
* items:
* type: string
* shirtSize:
* type: string
* enum: [XS, S, M, L, XL, XXL, WXS, WS, WM, WL, WXL, WXXL]
Expand All @@ -203,6 +211,8 @@ router.get("/team", isAuthenticated, asyncCatch(getOwnTeam));
* enum: [Rural, Suburban, Urban]
* attendingPhysically:
* type: boolean
* notes:
* type: string
* responses:
* 200:
* description: Success.
Expand Down

0 comments on commit ddbf35e

Please sign in to comment.