From 2f551b6a5debbed01cda08d6e1d7f35d44040c34 Mon Sep 17 00:00:00 2001 From: Nikhil Dange Date: Thu, 12 Oct 2023 19:45:43 -0700 Subject: [PATCH 1/6] seed data for resumes --- tests/Seeds.ts | 16 +++++++++++++++- tests/data/index.ts | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/Seeds.ts b/tests/Seeds.ts index 8633deef..ef859b6a 100644 --- a/tests/Seeds.ts +++ b/tests/Seeds.ts @@ -1,6 +1,8 @@ import * as moment from 'moment'; import { UserAccessType } from '../types'; -import { DatabaseConnection, EventFactory, MerchFactory, PortalState, UserFactory } from './data'; +import { DatabaseConnection, EventFactory, MerchFactory, PortalState, UserFactory, FileFactory, ResumeFactory } from './data'; +import { Config } from '../config'; + function getGraduationYear(n: number) { return moment().year() + n; @@ -116,6 +118,14 @@ async function seed(): Promise { accessType: UserAccessType.MERCH_STORE_DISTRIBUTOR, }); + const VISIBLE_RESUME_USER = UserFactory.fake(); + const RESUME_1 = ResumeFactory.fake({ user: VISIBLE_RESUME_USER, isResumeVisible: true }); + + const HIDDEN_RESUME_USER = UserFactory.fake(); + const RESUME_2 = ResumeFactory.fake({ user: HIDDEN_RESUME_USER, isResumeVisible: false }); + + + // create members in bulk for testing things like sliding leaderboard in a realistic manner const otherMembers = UserFactory.create(200); const highAttendanceMembers = otherMembers.slice(0, 50); @@ -549,6 +559,8 @@ async function seed(): Promise { USER_MARKETING, USER_MERCH_STORE_MANAGER, USER_MERCH_STORE_DISTRIBUTOR, + VISIBLE_RESUME_USER, + HIDDEN_RESUME_USER, ...otherMembers, ) .createEvents( @@ -642,6 +654,8 @@ async function seed(): Promise { .orderMerch(MEMBER_SOPHOMORE, [{ option: MERCH_ITEM_2_OPTION_2X2, quantity: 1 }], ONGOING_ORDER_PICKUP_EVENT) .orderMerch(MEMBER_JUNIOR, [{ option: MERCH_ITEM_2_OPTION_4X4, quantity: 2 }], ONGOING_ORDER_PICKUP_EVENT) .orderMerch(MEMBER_SENIOR, [{ option: MERCH_ITEM_2_OPTION_3X3, quantity: 1 }], ONGOING_ORDER_PICKUP_EVENT) + .createResumes(VISIBLE_RESUME_USER, RESUME_1) + .createResumes(HIDDEN_RESUME_USER, RESUME_2) .write(); } diff --git a/tests/data/index.ts b/tests/data/index.ts index e760ea5a..af016dbc 100644 --- a/tests/data/index.ts +++ b/tests/data/index.ts @@ -3,5 +3,7 @@ export * from './DatabaseConnection'; export * from './UserFactory'; export * from './EventFactory'; export * from './MerchFactory'; +export * from './ResumeFactory'; +export * from './FileFactory'; export * from './PortalState'; From 7ed2b975d7310f56f7bc8bfc132d85a86d1f5c5d Mon Sep 17 00:00:00 2001 From: Nikhil Dange Date: Thu, 12 Oct 2023 19:49:46 -0700 Subject: [PATCH 2/6] linting :( --- tests/Seeds.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/Seeds.ts b/tests/Seeds.ts index ef859b6a..74860cbe 100644 --- a/tests/Seeds.ts +++ b/tests/Seeds.ts @@ -1,8 +1,6 @@ import * as moment from 'moment'; import { UserAccessType } from '../types'; -import { DatabaseConnection, EventFactory, MerchFactory, PortalState, UserFactory, FileFactory, ResumeFactory } from './data'; -import { Config } from '../config'; - +import { DatabaseConnection, EventFactory, MerchFactory, PortalState, UserFactory, ResumeFactory } from './data'; function getGraduationYear(n: number) { return moment().year() + n; @@ -124,8 +122,6 @@ async function seed(): Promise { const HIDDEN_RESUME_USER = UserFactory.fake(); const RESUME_2 = ResumeFactory.fake({ user: HIDDEN_RESUME_USER, isResumeVisible: false }); - - // create members in bulk for testing things like sliding leaderboard in a realistic manner const otherMembers = UserFactory.create(200); const highAttendanceMembers = otherMembers.slice(0, 50); From 3b3b0d205f409ed5a0b46a1d234d3ecd5dbe7043 Mon Sep 17 00:00:00 2001 From: Nikhil Dange Date: Thu, 12 Oct 2023 19:53:51 -0700 Subject: [PATCH 3/6] bruh --- tests/Seeds.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Seeds.ts b/tests/Seeds.ts index 74860cbe..e8cea15d 100644 --- a/tests/Seeds.ts +++ b/tests/Seeds.ts @@ -116,11 +116,11 @@ async function seed(): Promise { accessType: UserAccessType.MERCH_STORE_DISTRIBUTOR, }); - const VISIBLE_RESUME_USER = UserFactory.fake(); - const RESUME_1 = ResumeFactory.fake({ user: VISIBLE_RESUME_USER, isResumeVisible: true }); + const USER_VISIBLE_RESUME = UserFactory.fake(); + const RESUME_1 = ResumeFactory.fake({ user: USER_VISIBLE_RESUME, isResumeVisible: true }); - const HIDDEN_RESUME_USER = UserFactory.fake(); - const RESUME_2 = ResumeFactory.fake({ user: HIDDEN_RESUME_USER, isResumeVisible: false }); + const USER_HIDDEN_RESUME = UserFactory.fake(); + const RESUME_2 = ResumeFactory.fake({ user: USER_HIDDEN_RESUME, isResumeVisible: false }); // create members in bulk for testing things like sliding leaderboard in a realistic manner const otherMembers = UserFactory.create(200); @@ -650,8 +650,8 @@ async function seed(): Promise { .orderMerch(MEMBER_SOPHOMORE, [{ option: MERCH_ITEM_2_OPTION_2X2, quantity: 1 }], ONGOING_ORDER_PICKUP_EVENT) .orderMerch(MEMBER_JUNIOR, [{ option: MERCH_ITEM_2_OPTION_4X4, quantity: 2 }], ONGOING_ORDER_PICKUP_EVENT) .orderMerch(MEMBER_SENIOR, [{ option: MERCH_ITEM_2_OPTION_3X3, quantity: 1 }], ONGOING_ORDER_PICKUP_EVENT) - .createResumes(VISIBLE_RESUME_USER, RESUME_1) - .createResumes(HIDDEN_RESUME_USER, RESUME_2) + .createResumes(USER_VISIBLE_RESUME, RESUME_1) + .createResumes(USER_HIDDEN_RESUME, RESUME_2) .write(); } From 1445548c47a5241a0e37409600dcf05db2dfb53f Mon Sep 17 00:00:00 2001 From: Nikhil Dange Date: Thu, 12 Oct 2023 20:50:50 -0700 Subject: [PATCH 4/6] typo --- tests/Seeds.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Seeds.ts b/tests/Seeds.ts index e8cea15d..dddc6bce 100644 --- a/tests/Seeds.ts +++ b/tests/Seeds.ts @@ -555,8 +555,8 @@ async function seed(): Promise { USER_MARKETING, USER_MERCH_STORE_MANAGER, USER_MERCH_STORE_DISTRIBUTOR, - VISIBLE_RESUME_USER, - HIDDEN_RESUME_USER, + USER_VISIBLE_RESUME, + USER_HIDDEN_RESUME, ...otherMembers, ) .createEvents( From 07fc232bf0956a986da300139197f689b53ef3f5 Mon Sep 17 00:00:00 2001 From: Nikhil Dange Date: Sat, 14 Oct 2023 12:23:26 -0700 Subject: [PATCH 5/6] unncessary file factory export --- tests/data/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/data/index.ts b/tests/data/index.ts index af016dbc..be09679f 100644 --- a/tests/data/index.ts +++ b/tests/data/index.ts @@ -4,6 +4,5 @@ export * from './UserFactory'; export * from './EventFactory'; export * from './MerchFactory'; export * from './ResumeFactory'; -export * from './FileFactory'; export * from './PortalState'; From 5912e6f97fc4eca5cf32c1f085c8809d10a324e0 Mon Sep 17 00:00:00 2001 From: Nikhil Dange Date: Sat, 21 Oct 2023 19:42:28 -0700 Subject: [PATCH 6/6] added pdf link to resumes --- tests/Seeds.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/Seeds.ts b/tests/Seeds.ts index dddc6bce..74ba5023 100644 --- a/tests/Seeds.ts +++ b/tests/Seeds.ts @@ -116,11 +116,13 @@ async function seed(): Promise { accessType: UserAccessType.MERCH_STORE_DISTRIBUTOR, }); + const RESUME_URL = 'https://acmucsd-local.s3.us-west-1.amazonaws.com/resumeSeedingData/alexface.pdf'; + const USER_VISIBLE_RESUME = UserFactory.fake(); - const RESUME_1 = ResumeFactory.fake({ user: USER_VISIBLE_RESUME, isResumeVisible: true }); + const RESUME_1 = ResumeFactory.fake({ user: USER_VISIBLE_RESUME, isResumeVisible: true, url: RESUME_URL }); const USER_HIDDEN_RESUME = UserFactory.fake(); - const RESUME_2 = ResumeFactory.fake({ user: USER_HIDDEN_RESUME, isResumeVisible: false }); + const RESUME_2 = ResumeFactory.fake({ user: USER_HIDDEN_RESUME, isResumeVisible: false, url: RESUME_URL }); // create members in bulk for testing things like sliding leaderboard in a realistic manner const otherMembers = UserFactory.create(200);