Skip to content

Commit 90690b5

Browse files
committed
mlh email check
1 parent 647978c commit 90690b5

File tree

7 files changed

+43
-26
lines changed

7 files changed

+43
-26
lines changed

app/config/swaggerconfig.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ const swaggerDefinition = {
233233
"resumeUrl": {
234234
"type": "string",
235235
"description": "File name of uploaded resume. Use the get resume routes to get a temporary access URL.",
236+
},
237+
"authorizeMLHEmail": {
238+
"type": "boolean",
239+
"description": "Whether the applicant authorizes MLH to send them emails",
240+
"default": false,
236241
}
237242
}
238243
},

app/database/Prisma.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const applicationSchema = z.object({
6363
userId: z.string().uuid("Must be a valid user ID").readonly(),
6464
status: StatusSchema.default(ApplicationStatus.PENDING).readonly(),
6565
resumeUrl: z.string("Resume URL must be valid").readonly(),
66+
authorizeMLHEmail: z.boolean().default(false),
6667
});
6768

6869
// Score schema

app/routes/Application.routes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ const router = express.Router();
7676
* type: string
7777
* format: binary
7878
* description: Resume file (PDF, DOC, DOCX, max 10MB)
79+
* authorizeMLHEmail:
80+
* type: boolean
7981
* responses:
8082
* 201:
8183
* description: Application successfully created

app/utils/formDataTransform.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ export const transformApplicationData = (formData) => {
2323
}
2424
}
2525

26+
if (transformed.authorizeMLHEmail !== undefined) {
27+
if (typeof transformed.authorizeMLHEmail === 'string') {
28+
transformed.authorizeMLHEmail = transformed.authorizeMLHEmail.toLowerCase() === 'true' || transformed.authorizeMLHEmail === '1';
29+
}
30+
}
31+
2632
// Remove empty strings and convert to null/undefined where appropriate
2733
Object.keys(transformed).forEach(key => {
2834
if (transformed[key] === '') {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"build:dev": "npm run migrate:dev && npx prisma generate",
3434
"build:test": "npx dotenv -e .env.test -- npx prisma migrate deploy && npx prisma generate",
3535
"build:prod": "npm run migrate:prod && npx prisma generate",
36-
"docker:dev": "docker compose -f docker-compose.dev.yml up --watch",
36+
"docker:dev": "docker compose -f docker-compose.dev.yml up --build --watch",
3737
"docker:test": "docker compose -f docker-compose.test.yml up --build --abort-on-container-exit --exit-code-from test-app",
3838
"docker:ext": "docker compose -f docker-compose.dev.yml up --build -d",
3939
"exitdocker:ext": "docker compose -f docker-compose.dev.yml down",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "Application" ADD COLUMN "authorizeMLHEmail" BOOLEAN NOT NULL DEFAULT false;

prisma/schema.prisma

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,32 @@ model User {
2323
}
2424

2525
model Application {
26-
id String @id @default(uuid())
27-
gender String
28-
pronouns String
29-
age Int
30-
ethnicity String
31-
gradYear Int
32-
phoneNumber String
33-
school String
34-
city String
35-
state String
36-
country String
37-
educationLevel String
38-
major String
39-
diet String
40-
shirtSize String
41-
sleep Boolean
42-
github String
43-
linkedin String
44-
portfolio String
45-
whyBostonhacks String
46-
resumeUrl String // defaults to showing just file name since get resume url is used to get the one time url
47-
applicationYear Int
48-
user User @relation(fields: [userId], references: [id])
49-
userId String
50-
status Status @default(PENDING)
26+
id String @id @default(uuid())
27+
gender String
28+
pronouns String
29+
age Int
30+
ethnicity String
31+
gradYear Int
32+
phoneNumber String
33+
school String
34+
city String
35+
state String
36+
country String
37+
educationLevel String
38+
major String
39+
diet String
40+
shirtSize String
41+
sleep Boolean
42+
github String
43+
linkedin String
44+
portfolio String
45+
whyBostonhacks String
46+
resumeUrl String // defaults to showing just file name since get resume url is used to get the one time url
47+
applicationYear Int
48+
user User @relation(fields: [userId], references: [id])
49+
userId String
50+
status Status @default(PENDING)
51+
authorizeMLHEmail Boolean @default(false)
5152
5253
@@index([userId])
5354
@@index([applicationYear])

0 commit comments

Comments
 (0)