From 744d6cffb17c2b9973ed1e80da663412c456ee69 Mon Sep 17 00:00:00 2001 From: Ciara <62266962+ciaracade@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:15:53 -0500 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20send=20anniversary=20email=20notifi?= =?UTF-8?q?cations=20=F0=9F=8E=82=20=20(#607)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/src/infrastructure/bull.types.ts | 4 ++ .../core/src/modules/member/member.worker.ts | 4 ++ .../use-cases/send-anniversary-email.ts | 40 ++++++++++++++++++ .../notification/use-cases/send-email.ts | 9 ++++ .../emails/student-anniversary.tsx | 41 +++++++++++++++++++ packages/email-templates/src/index.ts | 1 + packages/email-templates/src/types.ts | 7 ++++ 7 files changed, 106 insertions(+) create mode 100644 packages/core/src/modules/member/use-cases/send-anniversary-email.ts create mode 100644 packages/email-templates/emails/student-anniversary.tsx diff --git a/packages/core/src/infrastructure/bull.types.ts b/packages/core/src/infrastructure/bull.types.ts index e5da7357b..f5aed76ed 100644 --- a/packages/core/src/infrastructure/bull.types.ts +++ b/packages/core/src/infrastructure/bull.types.ts @@ -586,6 +586,10 @@ export const StudentBullJob = z.discriminatedUnion('name', [ studentId: Student.shape.id, }), }), + z.object({ + name: z.literal('student.anniversary.email'), + data: z.object({}), + }), z.object({ name: z.literal('student.birthdate.daily'), data: z.object({}), diff --git a/packages/core/src/modules/member/member.worker.ts b/packages/core/src/modules/member/member.worker.ts index 8daff95ec..5c03ff9b0 100644 --- a/packages/core/src/modules/member/member.worker.ts +++ b/packages/core/src/modules/member/member.worker.ts @@ -14,6 +14,7 @@ import { AIRTABLE_MEMBERS_TABLE_ID, } from '@/modules/airtable'; import { sendCompanyReviewNotifications } from '@/modules/employment/use-cases/send-company-review-notifications'; +import { sendAnniversaryEmail } from '@/modules/member/use-cases/send-anniversary-email'; import { success } from '@/shared/utils/core'; import { onActivationStepCompleted } from './events/activation-step-completed'; import { onMemberActivated } from './events/member-activated'; @@ -37,6 +38,9 @@ export const memberWorker = registerWorker( return onActivationStepCompleted(data); } ) + .with({ name: 'student.anniversary.email' }, ({ data }) => { + return sendAnniversaryEmail(data); + }) .with({ name: 'student.birthdate.daily' }, ({ data }) => { return sendBirthdayNotification(data); }) diff --git a/packages/core/src/modules/member/use-cases/send-anniversary-email.ts b/packages/core/src/modules/member/use-cases/send-anniversary-email.ts new file mode 100644 index 000000000..951098bd9 --- /dev/null +++ b/packages/core/src/modules/member/use-cases/send-anniversary-email.ts @@ -0,0 +1,40 @@ +import { sql } from 'kysely'; + +import { db } from '@oyster/db'; + +import { job } from '@/infrastructure/bull'; +import { type GetBullJobData } from '@/infrastructure/bull.types'; + +export async function sendAnniversaryEmail( + _: GetBullJobData<'student.anniversary.email'> +) { + const yearsDiff = sql` + extract(year from current_date) - extract(year from accepted_at) + `; + + const members = await db + .selectFrom('students') + .select(['email', 'firstName', yearsDiff.as('years')]) + .whereRef( + sql`(extract(month from accepted_at), extract(day from accepted_at))`, + '=', + sql`(extract(month from current_date), extract(day from current_date))` + ) + // We don't want to send a notification if they joined today before the + // notification was triggered. + .where(yearsDiff, '>', 0) + .execute(); + + // We won't send a notification if there are no members with anniversary today! + if (!members.length) { + return; + } + + members.forEach(({ email, firstName, years }) => { + job('notification.email.send', { + name: 'student-anniversary', + data: { firstName, years: Number(years) }, + to: email, + }); + }); +} diff --git a/packages/core/src/modules/notification/use-cases/send-email.ts b/packages/core/src/modules/notification/use-cases/send-email.ts index 50a03e2c2..a3aae89c2 100644 --- a/packages/core/src/modules/notification/use-cases/send-email.ts +++ b/packages/core/src/modules/notification/use-cases/send-email.ts @@ -11,6 +11,7 @@ import { ReferralAcceptedEmail, ReferralSentEmail, ResumeSubmittedEmail, + StudentAnniversaryEmail, StudentAttendedOnboardingEmail, StudentRemovedEmail, } from '@oyster/email-templates'; @@ -72,6 +73,7 @@ async function sendEmailWithPostmark(input: EmailTemplate) { .with('resume-submitted', () => FROM_NOTIFICATIONS) .with('referral-accepted', () => FROM_NOTIFICATIONS) .with('referral-sent', () => FROM_NOTIFICATIONS) + .with('student-anniversary', () => FROM_NOTIFICATIONS) .with('student-attended-onboarding', () => FROM_NOTIFICATIONS) .with('student-removed', () => FROM_NOTIFICATIONS) .exhaustive(); @@ -147,6 +149,9 @@ function getHtml(input: EmailTemplate): string { .with({ name: 'resume-submitted' }, ({ data }) => { return ResumeSubmittedEmail(data); }) + .with({ name: 'student-anniversary' }, ({ data }) => { + return StudentAnniversaryEmail(data); + }) .with({ name: 'student-attended-onboarding' }, ({ data }) => { return StudentAttendedOnboardingEmail(data); }) @@ -186,6 +191,9 @@ function getSubject(input: EmailTemplate): string { .with({ name: 'resume-submitted' }, ({ data }) => { return `Confirmation: ${data.resumeBookName} Resume Book! ✅`; }) + .with({ name: 'student-anniversary' }, ({ data }) => { + return `Happy ${data.years} Year Anniversary, ${data.firstName}! 🎉`; + }) .with({ name: 'student-attended-onboarding' }, () => { return "Onboarding Session, ✅! What's Next?"; }) @@ -221,6 +229,7 @@ async function getAttachments( { name: 'referral-accepted' }, { name: 'referral-sent' }, { name: 'resume-submitted' }, + { name: 'student-anniversary' }, { name: 'student-removed' }, () => { return undefined; diff --git a/packages/email-templates/emails/student-anniversary.tsx b/packages/email-templates/emails/student-anniversary.tsx new file mode 100644 index 000000000..4c3b65b14 --- /dev/null +++ b/packages/email-templates/emails/student-anniversary.tsx @@ -0,0 +1,41 @@ +import React from 'react'; + +import { Email } from './components/email'; +import { type EmailTemplateData } from '../src/types'; + +export function StudentAnniversaryEmail({ + firstName, + years, +}: EmailTemplateData<'student-anniversary'>) { + const yearLabel = years > 1 ? 'years' : 'year'; + + return ( + + + Congratulations on {years} {yearLabel} with ColorStack! 🎉 + + + + Hello {firstName}, + + + Happy ColorStack-aversary! 🥳 +
+
+ Over the past {years > 1 ? `${years} years` : 'year'}, you've shown + unwavering support, talent, and passion. Your commitment to this + community has truly made a difference. Thanks to members like you, + ColorStack continues to thrive and empower individuals across tech. + We're so grateful to have you as part of the ColorStack family! +
+
+ Here's to many more impactful years together! 🎉 +
+ + +
+
+ ); +} + +export default StudentAnniversaryEmail; diff --git a/packages/email-templates/src/index.ts b/packages/email-templates/src/index.ts index 1e1b32ce1..9eb26c215 100644 --- a/packages/email-templates/src/index.ts +++ b/packages/email-templates/src/index.ts @@ -6,6 +6,7 @@ export { PrimaryEmailChangedEmail } from '../emails/primary-email-changed'; export { ReferralAcceptedEmail } from '../emails/referral-accepted'; export { ReferralSentEmail } from '../emails/referral-sent'; export { ResumeSubmittedEmail } from '../emails/resume-submitted'; +export { StudentAnniversaryEmail } from '../emails/student-anniversary'; export { StudentAttendedOnboardingEmail } from '../emails/student-attended-onboarding'; export { StudentRemovedEmail } from '../emails/student-removed'; export { EmailTemplate } from './types'; diff --git a/packages/email-templates/src/types.ts b/packages/email-templates/src/types.ts index 182ea1c3c..aa40ac9a4 100644 --- a/packages/email-templates/src/types.ts +++ b/packages/email-templates/src/types.ts @@ -64,6 +64,13 @@ export const EmailTemplate = z.discriminatedUnion('name', [ resumeBookUri: z.string().url(), }), }), + BaseEmail.extend({ + name: z.literal('student-anniversary'), + data: z.object({ + firstName: z.string().trim().min(1), + years: z.number().int().positive(), // Years in ColorStack + }), + }), BaseEmail.extend({ name: z.literal('student-attended-onboarding'), data: z.object({ From fba5b3f253e39ae36c779c85db96f7d6d59e47d2 Mon Sep 17 00:00:00 2001 From: Rami Abdou <38056800+ramiAbdou@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:51:19 -0800 Subject: [PATCH 2/9] =?UTF-8?q?refactor:=20use=20plural=20form=20for=20mod?= =?UTF-8?q?ule=20names=20=F0=9F=94=84=20(#664)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/routes/_profile.resume.review.tsx | 2 +- packages/core/package.json | 32 ++++++++--------- packages/core/src/admin-dashboard.server.ts | 28 +++++++-------- packages/core/src/admin-dashboard.ui.ts | 8 ++--- packages/core/src/api.ts | 18 +++++----- .../core/src/infrastructure/bull.types.ts | 2 +- packages/core/src/member-profile.server.ts | 34 +++++++++---------- packages/core/src/member-profile.ui.ts | 6 ++-- .../queries/get-active-streak-leaderboard.ts | 0 .../queries/get-active-streak.ts | 0 .../shared/active-status.shared.ts | 0 .../use-cases/backfill-active-statuses.ts | 0 .../use-cases/create-new-active-statuses.ts | 0 .../{admin/admin.ts => admins/admins.ts} | 2 +- .../admin.types.ts => admins/admins.types.ts} | 0 .../admin.ui.tsx => admins/admins.ui.tsx} | 2 +- .../applications.ts} | 6 ++-- .../applications.types.ts} | 0 .../applications.ui.tsx} | 2 +- .../use-cases/login-with-oauth.ts | 2 +- .../use-cases/send-one-time-code.ts | 2 +- .../airmeet-event.service.ts | 0 .../{event/event.ts => events/events.ts} | 0 .../event.types.ts => events/events.types.ts} | 0 .../events.worker.ts} | 0 .../events/event-attended.ts | 0 .../events/event-registered.ts | 0 .../queries/count-event-attendees.ts | 0 .../queries/count-past-events.ts | 0 .../queries/count-upcoming-events.ts | 0 .../{event => events}/queries/get-event.ts | 0 .../queries/list-event-attendees.ts | 0 .../{event => events}/queries/list-events.ts | 0 .../use-cases/add-event-recording-link.ts | 2 +- .../use-cases/create-event.ts | 0 .../use-cases/register-for-event.ts | 0 .../use-cases/sync-airmeet-event.ts | 2 +- .../use-cases/sync-recent-airmeet-events.ts | 0 .../feature-flags.types.ts} | 0 .../queries/get-feature-flag.ts | 0 .../queries/is-feature-flag-enabled.ts | 2 +- .../queries/list-feature-flags.ts | 0 .../use-cases/create-feature-flag.ts | 2 +- .../use-cases/delete-feature-flag.ts | 0 .../use-cases/edit-feature-flag.ts | 2 +- .../icebreakers.types.ts} | 0 .../queries/get-icebreaker-prompts.ts | 0 .../queries/get-icebreaker-responses.ts | 0 .../use-cases/add-icebreaker-prompt.ts | 2 +- .../use-cases/upsert-icebreaker-responses.ts | 0 .../events/activation-step-completed.ts | 2 +- .../events/member-activated.ts | 0 .../events/member-created.ts | 0 .../events/member-email-added.ts | 0 .../events/member-primary-email-changed.ts | 0 .../events/member-removed.ts | 0 .../member-emails.worker.ts} | 0 .../{member/member.ts => members/members.ts} | 0 .../members.types.ts} | 0 .../members.worker.ts} | 6 ++-- .../{member => members}/profile.worker.ts | 0 .../queries/get-member-by-email.ts | 0 .../queries/list-emails.test.ts | 0 .../queries/list-emails.ts | 0 .../queries/list-members-in-directory.ts | 2 +- .../use-cases/activate-member.ts | 0 .../use-cases/backfill-engagement-records.ts | 0 .../use-cases/change-primary-email.ts | 2 +- .../use-cases/join-member-directory.ts | 0 .../use-cases/send-anniversary-email.ts | 0 .../use-cases/send-birthday-notification.ts | 0 .../send-profile-views-notification.ts | 0 .../use-cases/update-allow-email-share.ts | 0 .../use-cases/update-member-email.ts | 0 .../use-cases/update-member.ts | 0 .../use-cases/view-member-profile.ts | 0 .../notifications.worker.ts} | 2 +- .../shared/email.utils.ts | 0 .../use-cases/send-email.ts | 0 .../send-ephemeral-slack-notification.ts | 2 +- .../use-cases/send-slack-notification.ts | 2 +- .../events/onboarding-session-attended.ts | 0 .../onboarding-sessions.types.ts} | 0 .../onboarding-sessions.worker.ts} | 0 .../add-onboarding-session-attendees.ts | 0 .../use-cases/upload-onboarding-session.ts | 0 .../{opportunity.ts => opportunities.ts} | 0 .../referral.ts => referrals/referrals.ts} | 4 +-- .../referrals.types.ts} | 0 .../referrals.ui.tsx} | 4 +-- .../{resource => resources}/index.server.ts | 0 .../modules/{resource => resources}/index.ts | 2 +- .../queries/get-resource.ts | 2 +- .../queries/list-resources.ts | 4 +-- .../queries/list-tags.ts | 0 .../resources.types.ts} | 0 .../{resource => resources}/shared/index.ts | 0 .../use-cases/add-resource.ts | 2 +- .../use-cases/create-tag.ts | 2 +- .../use-cases/downvote-resource.ts | 2 +- .../use-cases/update-resource.ts | 2 +- .../use-cases/upvote-resource.ts | 2 +- .../use-cases/view-resource.ts | 2 +- .../resume-books.ts} | 2 +- .../resume-books.types.ts} | 0 .../resume-books.ui.tsx} | 2 +- .../{resume-review.ts => resume-reviews.ts} | 0 .../slack/events/slack-workspace-joined.ts | 2 +- packages/core/src/modules/slack/slack.ts | 2 +- .../slack/use-cases/add-slack-message.ts | 2 +- 110 files changed, 107 insertions(+), 107 deletions(-) rename packages/core/src/modules/{active-status => active-statuses}/queries/get-active-streak-leaderboard.ts (100%) rename packages/core/src/modules/{active-status => active-statuses}/queries/get-active-streak.ts (100%) rename packages/core/src/modules/{active-status => active-statuses}/shared/active-status.shared.ts (100%) rename packages/core/src/modules/{active-status => active-statuses}/use-cases/backfill-active-statuses.ts (100%) rename packages/core/src/modules/{active-status => active-statuses}/use-cases/create-new-active-statuses.ts (100%) rename packages/core/src/modules/{admin/admin.ts => admins/admins.ts} (99%) rename packages/core/src/modules/{admin/admin.types.ts => admins/admins.types.ts} (100%) rename packages/core/src/modules/{admin/admin.ui.tsx => admins/admins.ui.tsx} (98%) rename packages/core/src/modules/{application/application.ts => applications/applications.ts} (98%) rename packages/core/src/modules/{application/application.types.ts => applications/applications.types.ts} (100%) rename packages/core/src/modules/{application/application.ui.tsx => applications/applications.ui.tsx} (99%) rename packages/core/src/modules/{event => events}/airmeet-event.service.ts (100%) rename packages/core/src/modules/{event/event.ts => events/events.ts} (100%) rename packages/core/src/modules/{event/event.types.ts => events/events.types.ts} (100%) rename packages/core/src/modules/{event/event.worker.ts => events/events.worker.ts} (100%) rename packages/core/src/modules/{event => events}/events/event-attended.ts (100%) rename packages/core/src/modules/{event => events}/events/event-registered.ts (100%) rename packages/core/src/modules/{event => events}/queries/count-event-attendees.ts (100%) rename packages/core/src/modules/{event => events}/queries/count-past-events.ts (100%) rename packages/core/src/modules/{event => events}/queries/count-upcoming-events.ts (100%) rename packages/core/src/modules/{event => events}/queries/get-event.ts (100%) rename packages/core/src/modules/{event => events}/queries/list-event-attendees.ts (100%) rename packages/core/src/modules/{event => events}/queries/list-events.ts (100%) rename packages/core/src/modules/{event => events}/use-cases/add-event-recording-link.ts (95%) rename packages/core/src/modules/{event => events}/use-cases/create-event.ts (100%) rename packages/core/src/modules/{event => events}/use-cases/register-for-event.ts (100%) rename packages/core/src/modules/{event => events}/use-cases/sync-airmeet-event.ts (95%) rename packages/core/src/modules/{event => events}/use-cases/sync-recent-airmeet-events.ts (100%) rename packages/core/src/modules/{feature-flag/feature-flag.types.ts => feature-flags/feature-flags.types.ts} (100%) rename packages/core/src/modules/{feature-flag => feature-flags}/queries/get-feature-flag.ts (100%) rename packages/core/src/modules/{feature-flag => feature-flags}/queries/is-feature-flag-enabled.ts (81%) rename packages/core/src/modules/{feature-flag => feature-flags}/queries/list-feature-flags.ts (100%) rename packages/core/src/modules/{feature-flag => feature-flags}/use-cases/create-feature-flag.ts (94%) rename packages/core/src/modules/{feature-flag => feature-flags}/use-cases/delete-feature-flag.ts (100%) rename packages/core/src/modules/{feature-flag => feature-flags}/use-cases/edit-feature-flag.ts (94%) rename packages/core/src/modules/{icebreaker/icebreaker.types.ts => icebreakers/icebreakers.types.ts} (100%) rename packages/core/src/modules/{icebreaker => icebreakers}/queries/get-icebreaker-prompts.ts (100%) rename packages/core/src/modules/{icebreaker => icebreakers}/queries/get-icebreaker-responses.ts (100%) rename packages/core/src/modules/{icebreaker => icebreakers}/use-cases/add-icebreaker-prompt.ts (79%) rename packages/core/src/modules/{icebreaker => icebreakers}/use-cases/upsert-icebreaker-responses.ts (100%) rename packages/core/src/modules/{member => members}/events/activation-step-completed.ts (98%) rename packages/core/src/modules/{member => members}/events/member-activated.ts (100%) rename packages/core/src/modules/{member => members}/events/member-created.ts (100%) rename packages/core/src/modules/{member => members}/events/member-email-added.ts (100%) rename packages/core/src/modules/{member => members}/events/member-primary-email-changed.ts (100%) rename packages/core/src/modules/{member => members}/events/member-removed.ts (100%) rename packages/core/src/modules/{member/member-email.worker.ts => members/member-emails.worker.ts} (100%) rename packages/core/src/modules/{member/member.ts => members/members.ts} (100%) rename packages/core/src/modules/{member/member.types.ts => members/members.types.ts} (100%) rename packages/core/src/modules/{member/member.worker.ts => members/members.worker.ts} (95%) rename packages/core/src/modules/{member => members}/profile.worker.ts (100%) rename packages/core/src/modules/{member => members}/queries/get-member-by-email.ts (100%) rename packages/core/src/modules/{member => members}/queries/list-emails.test.ts (100%) rename packages/core/src/modules/{member => members}/queries/list-emails.ts (100%) rename packages/core/src/modules/{member => members}/queries/list-members-in-directory.ts (99%) rename packages/core/src/modules/{member => members}/use-cases/activate-member.ts (100%) rename packages/core/src/modules/{member => members}/use-cases/backfill-engagement-records.ts (100%) rename packages/core/src/modules/{member => members}/use-cases/change-primary-email.ts (93%) rename packages/core/src/modules/{member => members}/use-cases/join-member-directory.ts (100%) rename packages/core/src/modules/{member => members}/use-cases/send-anniversary-email.ts (100%) rename packages/core/src/modules/{member => members}/use-cases/send-birthday-notification.ts (100%) rename packages/core/src/modules/{member => members}/use-cases/send-profile-views-notification.ts (100%) rename packages/core/src/modules/{member => members}/use-cases/update-allow-email-share.ts (100%) rename packages/core/src/modules/{member => members}/use-cases/update-member-email.ts (100%) rename packages/core/src/modules/{member => members}/use-cases/update-member.ts (100%) rename packages/core/src/modules/{member => members}/use-cases/view-member-profile.ts (100%) rename packages/core/src/modules/{notification/notification.worker.ts => notifications/notifications.worker.ts} (94%) rename packages/core/src/modules/{notification => notifications}/shared/email.utils.ts (100%) rename packages/core/src/modules/{notification => notifications}/use-cases/send-email.ts (100%) rename packages/core/src/modules/{notification => notifications}/use-cases/send-ephemeral-slack-notification.ts (83%) rename packages/core/src/modules/{notification => notifications}/use-cases/send-slack-notification.ts (90%) rename packages/core/src/modules/{onboarding-session => onboarding-sessions}/events/onboarding-session-attended.ts (100%) rename packages/core/src/modules/{onboarding-session/onboarding-session.types.ts => onboarding-sessions/onboarding-sessions.types.ts} (100%) rename packages/core/src/modules/{onboarding-session/onboarding-session.worker.ts => onboarding-sessions/onboarding-sessions.worker.ts} (100%) rename packages/core/src/modules/{onboarding-session => onboarding-sessions}/use-cases/add-onboarding-session-attendees.ts (100%) rename packages/core/src/modules/{onboarding-session => onboarding-sessions}/use-cases/upload-onboarding-session.ts (100%) rename packages/core/src/modules/{opportunity.ts => opportunities.ts} (100%) rename packages/core/src/modules/{referral/referral.ts => referrals/referrals.ts} (96%) rename packages/core/src/modules/{referral/referral.types.ts => referrals/referrals.types.ts} (100%) rename packages/core/src/modules/{referral/referral.ui.tsx => referrals/referrals.ui.tsx} (90%) rename packages/core/src/modules/{resource => resources}/index.server.ts (100%) rename packages/core/src/modules/{resource => resources}/index.ts (86%) rename packages/core/src/modules/{resource => resources}/queries/get-resource.ts (94%) rename packages/core/src/modules/{resource => resources}/queries/list-resources.ts (98%) rename packages/core/src/modules/{resource => resources}/queries/list-tags.ts (100%) rename packages/core/src/modules/{resource/resource.types.ts => resources/resources.types.ts} (100%) rename packages/core/src/modules/{resource => resources}/shared/index.ts (100%) rename packages/core/src/modules/{resource => resources}/use-cases/add-resource.ts (95%) rename packages/core/src/modules/{resource => resources}/use-cases/create-tag.ts (83%) rename packages/core/src/modules/{resource => resources}/use-cases/downvote-resource.ts (89%) rename packages/core/src/modules/{resource => resources}/use-cases/update-resource.ts (97%) rename packages/core/src/modules/{resource => resources}/use-cases/upvote-resource.ts (90%) rename packages/core/src/modules/{resource => resources}/use-cases/view-resource.ts (83%) rename packages/core/src/modules/{resume-book/resume-book.ts => resume-books/resume-books.ts} (99%) rename packages/core/src/modules/{resume-book/resume-book.types.ts => resume-books/resume-books.types.ts} (100%) rename packages/core/src/modules/{resume-book/resume-book.ui.tsx => resume-books/resume-books.ui.tsx} (97%) rename packages/core/src/modules/{resume-review.ts => resume-reviews.ts} (100%) diff --git a/apps/member-profile/app/routes/_profile.resume.review.tsx b/apps/member-profile/app/routes/_profile.resume.review.tsx index deec5ffb3..efb06ccf7 100644 --- a/apps/member-profile/app/routes/_profile.resume.review.tsx +++ b/apps/member-profile/app/routes/_profile.resume.review.tsx @@ -24,7 +24,7 @@ import { type ResumeFeedback, reviewResume, ReviewResumeInput, -} from '@oyster/core/resume-review'; +} from '@oyster/core/resume-reviews'; import { Button, cx, diff --git a/packages/core/package.json b/packages/core/package.json index 8765760f5..a1061fc8a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -13,19 +13,19 @@ "./admin-dashboard/ui": "./src/admin-dashboard.ui.ts", "./member-profile/server": "./src/member-profile.server.ts", "./member-profile/ui": "./src/member-profile.ui.ts", - "./admins": "./src/modules/admin/admin.ts", - "./admins/types": "./src/modules/admin/admin.types.ts", - "./admins/ui": "./src/modules/admin/admin.ui.tsx", - "./applications": "./src/modules/application/application.ts", - "./applications/types": "./src/modules/application/application.types.ts", - "./applications/ui": "./src/modules/application/application.ui.tsx", + "./admins": "./src/modules/admins/admins.ts", + "./admins/types": "./src/modules/admins/admins.types.ts", + "./admins/ui": "./src/modules/admins/admins.ui.tsx", + "./applications": "./src/modules/applications/applications.ts", + "./applications/types": "./src/modules/applications/applications.types.ts", + "./applications/ui": "./src/modules/applications/applications.ui.tsx", "./bull": "./src/infrastructure/bull.ts", "./education": "./src/modules/education/education.ts", "./education/types": "./src/modules/education/education.types.ts", "./education/ui": "./src/modules/education/education.ui.tsx", "./employment": "./src/modules/employment/index.ts", "./employment/server": "./src/modules/employment/index.server.ts", - "./events": "./src/modules/event/event.ts", + "./events": "./src/modules/events/events.ts", "./gamification": "./src/modules/gamification/gamification.ts", "./gamification/types": "./src/modules/gamification/gamification.types.ts", "./gamification/ui": "./src/modules/gamification/gamification.ui.tsx", @@ -37,16 +37,16 @@ "./mixpanel": "./src/infrastructure/mixpanel.ts", "./offers": "./src/modules/compensation/offers.ts", "./offers/ui": "./src/modules/compensation/offers.ui.tsx", - "./opportunities": "./src/modules/opportunity.ts", - "./referrals": "./src/modules/referral/referral.ts", - "./referrals/ui": "./src/modules/referral/referral.ui.tsx", + "./opportunities": "./src/modules/opportunities.ts", + "./referrals": "./src/modules/referrals/referrals.ts", + "./referrals/ui": "./src/modules/referrals/referrals.ui.tsx", "./remix": "./src/shared/utils/remix.ts", - "./resources": "./src/modules/resource/index.ts", - "./resources/server": "./src/modules/resource/index.server.ts", - "./resume-books": "./src/modules/resume-book/resume-book.ts", - "./resume-books/types": "./src/modules/resume-book/resume-book.types.ts", - "./resume-books/ui": "./src/modules/resume-book/resume-book.ui.tsx", - "./resume-review": "./src/modules/resume-review.ts", + "./resources": "./src/modules/resources/index.ts", + "./resources/server": "./src/modules/resources/index.server.ts", + "./resume-books": "./src/modules/resume-books/resume-books.ts", + "./resume-books/types": "./src/modules/resume-books/resume-books.types.ts", + "./resume-books/ui": "./src/modules/resume-books/resume-books.ui.tsx", + "./resume-reviews": "./src/modules/resume-reviews.ts", "./s3": "./src/infrastructure/s3.ts", "./slack": "./src/modules/slack/slack.ts", "./slack/server": "./src/modules/slack/index.server.ts" diff --git a/packages/core/src/admin-dashboard.server.ts b/packages/core/src/admin-dashboard.server.ts index a75db3727..e117ffb7e 100644 --- a/packages/core/src/admin-dashboard.server.ts +++ b/packages/core/src/admin-dashboard.server.ts @@ -1,18 +1,18 @@ export { getGoogleAuthUri } from './modules/authentication/shared/oauth.utils'; export { sendOneTimeCode } from './modules/authentication/use-cases/send-one-time-code'; export { verifyOneTimeCode } from './modules/authentication/use-cases/verify-one-time-code'; -export { getEvent } from './modules/event/queries/get-event'; -export { listEvents } from './modules/event/queries/list-events'; -export { addEventRecordingLink } from './modules/event/use-cases/add-event-recording-link'; -export { createEvent } from './modules/event/use-cases/create-event'; -export { getFeatureFlag } from './modules/feature-flag/queries/get-feature-flag'; -export { listFeatureFlags } from './modules/feature-flag/queries/list-feature-flags'; -export { createFeatureFlag } from './modules/feature-flag/use-cases/create-feature-flag'; -export { deleteFeatureFlag } from './modules/feature-flag/use-cases/delete-feature-flag'; -export { editFeatureFlag } from './modules/feature-flag/use-cases/edit-feature-flag'; -export { addIcebreakerPrompt } from './modules/icebreaker/use-cases/add-icebreaker-prompt'; -export { activateMember } from './modules/member/use-cases/activate-member'; -export { updateMemberEmail } from './modules/member/use-cases/update-member-email'; -export { addOnboardingSessionAttendees } from './modules/onboarding-session/use-cases/add-onboarding-session-attendees'; -export { uploadOnboardingSession } from './modules/onboarding-session/use-cases/upload-onboarding-session'; +export { getEvent } from './modules/events/queries/get-event'; +export { listEvents } from './modules/events/queries/list-events'; +export { addEventRecordingLink } from './modules/events/use-cases/add-event-recording-link'; +export { createEvent } from './modules/events/use-cases/create-event'; +export { getFeatureFlag } from './modules/feature-flags/queries/get-feature-flag'; +export { listFeatureFlags } from './modules/feature-flags/queries/list-feature-flags'; +export { createFeatureFlag } from './modules/feature-flags/use-cases/create-feature-flag'; +export { deleteFeatureFlag } from './modules/feature-flags/use-cases/delete-feature-flag'; +export { editFeatureFlag } from './modules/feature-flags/use-cases/edit-feature-flag'; +export { addIcebreakerPrompt } from './modules/icebreakers/use-cases/add-icebreaker-prompt'; +export { activateMember } from './modules/members/use-cases/activate-member'; +export { updateMemberEmail } from './modules/members/use-cases/update-member-email'; +export { addOnboardingSessionAttendees } from './modules/onboarding-sessions/use-cases/add-onboarding-session-attendees'; +export { uploadOnboardingSession } from './modules/onboarding-sessions/use-cases/upload-onboarding-session'; export { parseCsv } from './shared/utils/csv'; diff --git a/packages/core/src/admin-dashboard.ui.ts b/packages/core/src/admin-dashboard.ui.ts index 79344e958..cf40434a8 100644 --- a/packages/core/src/admin-dashboard.ui.ts +++ b/packages/core/src/admin-dashboard.ui.ts @@ -7,11 +7,11 @@ export { CreateSchoolInput, EducationLevel, } from './modules/education/education.types'; -export { AddEventRecordingLinkInput } from './modules/event/event.types'; +export { AddEventRecordingLinkInput } from './modules/events/events.types'; export { CreateFeatureFlagInput, EditFeatureFlagInput, -} from './modules/feature-flag/feature-flag.types'; -export { AddIcebreakerPromptInput } from './modules/icebreaker/icebreaker.types'; -export { OnboardingSession } from './modules/onboarding-session/onboarding-session.types'; +} from './modules/feature-flags/feature-flags.types'; +export { AddIcebreakerPromptInput } from './modules/icebreakers/icebreakers.types'; +export { OnboardingSession } from './modules/onboarding-sessions/onboarding-sessions.types'; export { Environment, ListSearchParams } from './shared/types'; diff --git a/packages/core/src/api.ts b/packages/core/src/api.ts index a173ac2fd..0f98328e4 100644 --- a/packages/core/src/api.ts +++ b/packages/core/src/api.ts @@ -8,20 +8,20 @@ dayjs.extend(utc); dayjs.extend(timezone); import { airtableWorker } from './modules/airtable'; -import { applicationWorker } from './modules/application/application'; +import { applicationWorker } from './modules/applications/applications'; import { oneTimeCodeWorker } from './modules/authentication/one-time-code.worker'; import { offerWorker } from './modules/compensation/offers'; -import { eventWorker } from './modules/event/event.worker'; +import { eventWorker } from './modules/events/events.worker'; import { feedWorker } from './modules/feed'; import { gamificationWorker } from './modules/gamification/gamification'; import { mailchimpWorker } from './modules/mailchimp'; -import { memberEmailWorker } from './modules/member/member-email.worker'; -import { memberWorker } from './modules/member/member.worker'; -import { profileWorker } from './modules/member/profile.worker'; -import { notificationWorker } from './modules/notification/notification.worker'; -import { onboardingSessionWorker } from './modules/onboarding-session/onboarding-session.worker'; -import { opportunityWorker } from './modules/opportunity'; -import { resumeReviewWorker } from './modules/resume-review'; +import { memberEmailWorker } from './modules/members/member-emails.worker'; +import { memberWorker } from './modules/members/members.worker'; +import { profileWorker } from './modules/members/profile.worker'; +import { notificationWorker } from './modules/notifications/notifications.worker'; +import { onboardingSessionWorker } from './modules/onboarding-sessions/onboarding-sessions.worker'; +import { opportunityWorker } from './modules/opportunities'; +import { resumeReviewWorker } from './modules/resume-reviews'; import { slackWorker } from './modules/slack/slack.worker'; export { job } from './infrastructure/bull'; diff --git a/packages/core/src/infrastructure/bull.types.ts b/packages/core/src/infrastructure/bull.types.ts index f5aed76ed..0a76c7a40 100644 --- a/packages/core/src/infrastructure/bull.types.ts +++ b/packages/core/src/infrastructure/bull.types.ts @@ -17,7 +17,7 @@ import { ActivityType, CompletedActivity, } from '@/modules/gamification/gamification.types'; -import { OnboardingSession } from '@/modules/onboarding-session/onboarding-session.types'; +import { OnboardingSession } from '@/modules/onboarding-sessions/onboarding-sessions.types'; import { SlackChannel, SlackMessage, diff --git a/packages/core/src/member-profile.server.ts b/packages/core/src/member-profile.server.ts index f7a7981ee..ded201852 100644 --- a/packages/core/src/member-profile.server.ts +++ b/packages/core/src/member-profile.server.ts @@ -1,6 +1,6 @@ export { reportException } from './infrastructure/sentry'; -export { getActiveStreak } from './modules/active-status/queries/get-active-streak'; -export { getActiveStreakLeaderboard } from './modules/active-status/queries/get-active-streak-leaderboard'; +export { getActiveStreak } from './modules/active-statuses/queries/get-active-streak'; +export { getActiveStreakLeaderboard } from './modules/active-statuses/queries/get-active-streak-leaderboard'; export { getGithubProfile } from './modules/authentication/queries/get-github-profile'; export { getGoogleAuthUri, @@ -19,19 +19,19 @@ export { searchCrunchbaseOrganizations } from './modules/employment/queries/sear export { addWorkExperience } from './modules/employment/use-cases/add-work-experience'; export { deleteWorkExperience } from './modules/employment/use-cases/delete-work-experience'; export { editWorkExperience } from './modules/employment/use-cases/edit-work-experience'; -export { countEventAttendees } from './modules/event/queries/count-event-attendees'; -export { countPastEvents } from './modules/event/queries/count-past-events'; -export { countUpcomingEvents } from './modules/event/queries/count-upcoming-events'; -export { getEvent } from './modules/event/queries/get-event'; -export { listEventAttendees } from './modules/event/queries/list-event-attendees'; -export { isFeatureFlagEnabled } from './modules/feature-flag/queries/is-feature-flag-enabled'; -export { getIcebreakerPrompts } from './modules/icebreaker/queries/get-icebreaker-prompts'; -export { getIcebreakerResponses } from './modules/icebreaker/queries/get-icebreaker-responses'; -export { upsertIcebreakerResponses } from './modules/icebreaker/use-cases/upsert-icebreaker-responses'; -export { listEmails } from './modules/member/queries/list-emails'; -export { listMembersInDirectory } from './modules/member/queries/list-members-in-directory'; -export { changePrimaryEmail } from './modules/member/use-cases/change-primary-email'; -export { joinMemberDirectory } from './modules/member/use-cases/join-member-directory'; -export { updateAllowEmailShare } from './modules/member/use-cases/update-allow-email-share'; -export { updateMember } from './modules/member/use-cases/update-member'; +export { countEventAttendees } from './modules/events/queries/count-event-attendees'; +export { countPastEvents } from './modules/events/queries/count-past-events'; +export { countUpcomingEvents } from './modules/events/queries/count-upcoming-events'; +export { getEvent } from './modules/events/queries/get-event'; +export { listEventAttendees } from './modules/events/queries/list-event-attendees'; +export { isFeatureFlagEnabled } from './modules/feature-flags/queries/is-feature-flag-enabled'; +export { getIcebreakerPrompts } from './modules/icebreakers/queries/get-icebreaker-prompts'; +export { getIcebreakerResponses } from './modules/icebreakers/queries/get-icebreaker-responses'; +export { upsertIcebreakerResponses } from './modules/icebreakers/use-cases/upsert-icebreaker-responses'; +export { listEmails } from './modules/members/queries/list-emails'; +export { listMembersInDirectory } from './modules/members/queries/list-members-in-directory'; +export { changePrimaryEmail } from './modules/members/use-cases/change-primary-email'; +export { joinMemberDirectory } from './modules/members/use-cases/join-member-directory'; +export { updateAllowEmailShare } from './modules/members/use-cases/update-allow-email-share'; +export { updateMember } from './modules/members/use-cases/update-member'; export { countMessagesSent } from './modules/slack/queries/count-messages-sent'; diff --git a/packages/core/src/member-profile.ui.ts b/packages/core/src/member-profile.ui.ts index 3f0a63171..c2570e21d 100644 --- a/packages/core/src/member-profile.ui.ts +++ b/packages/core/src/member-profile.ui.ts @@ -32,11 +32,11 @@ export { WorkForm } from './modules/employment/ui/work-form'; export { IcebreakerPrompt, IcebreakerResponse, -} from './modules/icebreaker/icebreaker.types'; +} from './modules/icebreakers/icebreakers.types'; export { ChangePrimaryEmailInput, ListMembersInDirectoryWhere, -} from './modules/member/member.types'; -export { CreateResumeBookInput } from './modules/resume-book/resume-book.types'; +} from './modules/members/members.types'; +export { CreateResumeBookInput } from './modules/resume-books/resume-books.types'; export { getRandomAccentColor } from './shared/utils/color'; export { Environment, ListSearchParams } from './shared/types'; diff --git a/packages/core/src/modules/active-status/queries/get-active-streak-leaderboard.ts b/packages/core/src/modules/active-statuses/queries/get-active-streak-leaderboard.ts similarity index 100% rename from packages/core/src/modules/active-status/queries/get-active-streak-leaderboard.ts rename to packages/core/src/modules/active-statuses/queries/get-active-streak-leaderboard.ts diff --git a/packages/core/src/modules/active-status/queries/get-active-streak.ts b/packages/core/src/modules/active-statuses/queries/get-active-streak.ts similarity index 100% rename from packages/core/src/modules/active-status/queries/get-active-streak.ts rename to packages/core/src/modules/active-statuses/queries/get-active-streak.ts diff --git a/packages/core/src/modules/active-status/shared/active-status.shared.ts b/packages/core/src/modules/active-statuses/shared/active-status.shared.ts similarity index 100% rename from packages/core/src/modules/active-status/shared/active-status.shared.ts rename to packages/core/src/modules/active-statuses/shared/active-status.shared.ts diff --git a/packages/core/src/modules/active-status/use-cases/backfill-active-statuses.ts b/packages/core/src/modules/active-statuses/use-cases/backfill-active-statuses.ts similarity index 100% rename from packages/core/src/modules/active-status/use-cases/backfill-active-statuses.ts rename to packages/core/src/modules/active-statuses/use-cases/backfill-active-statuses.ts diff --git a/packages/core/src/modules/active-status/use-cases/create-new-active-statuses.ts b/packages/core/src/modules/active-statuses/use-cases/create-new-active-statuses.ts similarity index 100% rename from packages/core/src/modules/active-status/use-cases/create-new-active-statuses.ts rename to packages/core/src/modules/active-statuses/use-cases/create-new-active-statuses.ts diff --git a/packages/core/src/modules/admin/admin.ts b/packages/core/src/modules/admins/admins.ts similarity index 99% rename from packages/core/src/modules/admin/admin.ts rename to packages/core/src/modules/admins/admins.ts index 3739e821f..bf68b2738 100644 --- a/packages/core/src/modules/admin/admin.ts +++ b/packages/core/src/modules/admins/admins.ts @@ -7,7 +7,7 @@ import { type AddAdminInput, AdminRole, type RemoveAdminInput, -} from './admin.types'; +} from './admins.types'; // Types diff --git a/packages/core/src/modules/admin/admin.types.ts b/packages/core/src/modules/admins/admins.types.ts similarity index 100% rename from packages/core/src/modules/admin/admin.types.ts rename to packages/core/src/modules/admins/admins.types.ts diff --git a/packages/core/src/modules/admin/admin.ui.tsx b/packages/core/src/modules/admins/admins.ui.tsx similarity index 98% rename from packages/core/src/modules/admin/admin.ui.tsx rename to packages/core/src/modules/admins/admins.ui.tsx index 656ab85b9..28f8eae96 100644 --- a/packages/core/src/modules/admin/admin.ui.tsx +++ b/packages/core/src/modules/admins/admins.ui.tsx @@ -16,7 +16,7 @@ import { type TableColumnProps, } from '@oyster/ui'; -import { AddAdminInput, AdminRole } from '@/modules/admin/admin.types'; +import { AddAdminInput, AdminRole } from '@/modules/admins/admins.types'; // Admin Form diff --git a/packages/core/src/modules/application/application.ts b/packages/core/src/modules/applications/applications.ts similarity index 98% rename from packages/core/src/modules/application/application.ts rename to packages/core/src/modules/applications/applications.ts index 8d014aa6f..b9c75baed 100644 --- a/packages/core/src/modules/application/application.ts +++ b/packages/core/src/modules/applications/applications.ts @@ -15,9 +15,9 @@ import { type ApplicationRejectionReason, ApplicationStatus, type ApplyInput, -} from '@/modules/application/application.types'; -import { getPostmarkInstance } from '@/modules/notification/shared/email.utils'; -import { ReferralStatus } from '@/modules/referral/referral.types'; +} from '@/modules/applications/applications.types'; +import { getPostmarkInstance } from '@/modules/notifications/shared/email.utils'; +import { ReferralStatus } from '@/modules/referrals/referrals.types'; import { STUDENT_PROFILE_URL } from '@/shared/env'; // Queries diff --git a/packages/core/src/modules/application/application.types.ts b/packages/core/src/modules/applications/applications.types.ts similarity index 100% rename from packages/core/src/modules/application/application.types.ts rename to packages/core/src/modules/applications/applications.types.ts diff --git a/packages/core/src/modules/application/application.ui.tsx b/packages/core/src/modules/applications/applications.ui.tsx similarity index 99% rename from packages/core/src/modules/application/application.ui.tsx rename to packages/core/src/modules/applications/applications.ui.tsx index 06c52d41b..f6973806a 100644 --- a/packages/core/src/modules/application/application.ui.tsx +++ b/packages/core/src/modules/applications/applications.ui.tsx @@ -36,7 +36,7 @@ import { export { ApplicationStatus, ApplyInput, -} from '@/modules/application/application.types'; +} from '@/modules/applications/applications.types'; const ApplicationContext = React.createContext({ isOtherMajor: false, diff --git a/packages/core/src/modules/authentication/use-cases/login-with-oauth.ts b/packages/core/src/modules/authentication/use-cases/login-with-oauth.ts index 02457055e..dee3e7a22 100644 --- a/packages/core/src/modules/authentication/use-cases/login-with-oauth.ts +++ b/packages/core/src/modules/authentication/use-cases/login-with-oauth.ts @@ -2,7 +2,7 @@ import { match } from 'ts-pattern'; import { db } from '@oyster/db'; -import { getMemberByEmail } from '@/modules/member/queries/get-member-by-email'; +import { getMemberByEmail } from '@/modules/members/queries/get-member-by-email'; import { signToken } from '@/shared/utils/auth'; import { type OAuthCodeState } from '../authentication.types'; import { type OAuthServiceType } from '../oauth.service'; diff --git a/packages/core/src/modules/authentication/use-cases/send-one-time-code.ts b/packages/core/src/modules/authentication/use-cases/send-one-time-code.ts index b8cb3bead..6f1fd94d4 100644 --- a/packages/core/src/modules/authentication/use-cases/send-one-time-code.ts +++ b/packages/core/src/modules/authentication/use-cases/send-one-time-code.ts @@ -4,7 +4,7 @@ import { db } from '@oyster/db'; import { id } from '@oyster/utils'; import { job } from '@/infrastructure/bull'; -import { sendEmail } from '@/modules/notification/use-cases/send-email'; +import { sendEmail } from '@/modules/notifications/use-cases/send-email'; import { IS_DEVELOPMENT } from '@/shared/env'; import type { OneTimeCode, diff --git a/packages/core/src/modules/event/airmeet-event.service.ts b/packages/core/src/modules/events/airmeet-event.service.ts similarity index 100% rename from packages/core/src/modules/event/airmeet-event.service.ts rename to packages/core/src/modules/events/airmeet-event.service.ts diff --git a/packages/core/src/modules/event/event.ts b/packages/core/src/modules/events/events.ts similarity index 100% rename from packages/core/src/modules/event/event.ts rename to packages/core/src/modules/events/events.ts diff --git a/packages/core/src/modules/event/event.types.ts b/packages/core/src/modules/events/events.types.ts similarity index 100% rename from packages/core/src/modules/event/event.types.ts rename to packages/core/src/modules/events/events.types.ts diff --git a/packages/core/src/modules/event/event.worker.ts b/packages/core/src/modules/events/events.worker.ts similarity index 100% rename from packages/core/src/modules/event/event.worker.ts rename to packages/core/src/modules/events/events.worker.ts diff --git a/packages/core/src/modules/event/events/event-attended.ts b/packages/core/src/modules/events/events/event-attended.ts similarity index 100% rename from packages/core/src/modules/event/events/event-attended.ts rename to packages/core/src/modules/events/events/event-attended.ts diff --git a/packages/core/src/modules/event/events/event-registered.ts b/packages/core/src/modules/events/events/event-registered.ts similarity index 100% rename from packages/core/src/modules/event/events/event-registered.ts rename to packages/core/src/modules/events/events/event-registered.ts diff --git a/packages/core/src/modules/event/queries/count-event-attendees.ts b/packages/core/src/modules/events/queries/count-event-attendees.ts similarity index 100% rename from packages/core/src/modules/event/queries/count-event-attendees.ts rename to packages/core/src/modules/events/queries/count-event-attendees.ts diff --git a/packages/core/src/modules/event/queries/count-past-events.ts b/packages/core/src/modules/events/queries/count-past-events.ts similarity index 100% rename from packages/core/src/modules/event/queries/count-past-events.ts rename to packages/core/src/modules/events/queries/count-past-events.ts diff --git a/packages/core/src/modules/event/queries/count-upcoming-events.ts b/packages/core/src/modules/events/queries/count-upcoming-events.ts similarity index 100% rename from packages/core/src/modules/event/queries/count-upcoming-events.ts rename to packages/core/src/modules/events/queries/count-upcoming-events.ts diff --git a/packages/core/src/modules/event/queries/get-event.ts b/packages/core/src/modules/events/queries/get-event.ts similarity index 100% rename from packages/core/src/modules/event/queries/get-event.ts rename to packages/core/src/modules/events/queries/get-event.ts diff --git a/packages/core/src/modules/event/queries/list-event-attendees.ts b/packages/core/src/modules/events/queries/list-event-attendees.ts similarity index 100% rename from packages/core/src/modules/event/queries/list-event-attendees.ts rename to packages/core/src/modules/events/queries/list-event-attendees.ts diff --git a/packages/core/src/modules/event/queries/list-events.ts b/packages/core/src/modules/events/queries/list-events.ts similarity index 100% rename from packages/core/src/modules/event/queries/list-events.ts rename to packages/core/src/modules/events/queries/list-events.ts diff --git a/packages/core/src/modules/event/use-cases/add-event-recording-link.ts b/packages/core/src/modules/events/use-cases/add-event-recording-link.ts similarity index 95% rename from packages/core/src/modules/event/use-cases/add-event-recording-link.ts rename to packages/core/src/modules/events/use-cases/add-event-recording-link.ts index b455c4c15..75ae1d5b8 100644 --- a/packages/core/src/modules/event/use-cases/add-event-recording-link.ts +++ b/packages/core/src/modules/events/use-cases/add-event-recording-link.ts @@ -1,6 +1,6 @@ import { db } from '@oyster/db'; -import { type AddEventRecordingLinkInput } from '@/modules/event/event.types'; +import { type AddEventRecordingLinkInput } from '@/modules/events/events.types'; export async function addEventRecordingLink( id: string, diff --git a/packages/core/src/modules/event/use-cases/create-event.ts b/packages/core/src/modules/events/use-cases/create-event.ts similarity index 100% rename from packages/core/src/modules/event/use-cases/create-event.ts rename to packages/core/src/modules/events/use-cases/create-event.ts diff --git a/packages/core/src/modules/event/use-cases/register-for-event.ts b/packages/core/src/modules/events/use-cases/register-for-event.ts similarity index 100% rename from packages/core/src/modules/event/use-cases/register-for-event.ts rename to packages/core/src/modules/events/use-cases/register-for-event.ts diff --git a/packages/core/src/modules/event/use-cases/sync-airmeet-event.ts b/packages/core/src/modules/events/use-cases/sync-airmeet-event.ts similarity index 95% rename from packages/core/src/modules/event/use-cases/sync-airmeet-event.ts rename to packages/core/src/modules/events/use-cases/sync-airmeet-event.ts index b2f96e81a..4c656455e 100644 --- a/packages/core/src/modules/event/use-cases/sync-airmeet-event.ts +++ b/packages/core/src/modules/events/use-cases/sync-airmeet-event.ts @@ -2,7 +2,7 @@ import { db } from '@oyster/db'; import { job } from '@/infrastructure/bull'; import { type GetBullJobData } from '@/infrastructure/bull.types'; -import { getMemberByEmail } from '@/modules/member/queries/get-member-by-email'; +import { getMemberByEmail } from '@/modules/members/queries/get-member-by-email'; import { NotFoundError } from '@/shared/errors'; import { getAirmeetEvent, diff --git a/packages/core/src/modules/event/use-cases/sync-recent-airmeet-events.ts b/packages/core/src/modules/events/use-cases/sync-recent-airmeet-events.ts similarity index 100% rename from packages/core/src/modules/event/use-cases/sync-recent-airmeet-events.ts rename to packages/core/src/modules/events/use-cases/sync-recent-airmeet-events.ts diff --git a/packages/core/src/modules/feature-flag/feature-flag.types.ts b/packages/core/src/modules/feature-flags/feature-flags.types.ts similarity index 100% rename from packages/core/src/modules/feature-flag/feature-flag.types.ts rename to packages/core/src/modules/feature-flags/feature-flags.types.ts diff --git a/packages/core/src/modules/feature-flag/queries/get-feature-flag.ts b/packages/core/src/modules/feature-flags/queries/get-feature-flag.ts similarity index 100% rename from packages/core/src/modules/feature-flag/queries/get-feature-flag.ts rename to packages/core/src/modules/feature-flags/queries/get-feature-flag.ts diff --git a/packages/core/src/modules/feature-flag/queries/is-feature-flag-enabled.ts b/packages/core/src/modules/feature-flags/queries/is-feature-flag-enabled.ts similarity index 81% rename from packages/core/src/modules/feature-flag/queries/is-feature-flag-enabled.ts rename to packages/core/src/modules/feature-flags/queries/is-feature-flag-enabled.ts index 895a97f75..c8e181ebc 100644 --- a/packages/core/src/modules/feature-flag/queries/is-feature-flag-enabled.ts +++ b/packages/core/src/modules/feature-flags/queries/is-feature-flag-enabled.ts @@ -1,6 +1,6 @@ import { db } from '@oyster/db'; -import { type FeatureFlagName } from '../feature-flag.types'; +import { type FeatureFlagName } from '../feature-flags.types'; export async function isFeatureFlagEnabled(name: FeatureFlagName) { const enabledFlag = await db diff --git a/packages/core/src/modules/feature-flag/queries/list-feature-flags.ts b/packages/core/src/modules/feature-flags/queries/list-feature-flags.ts similarity index 100% rename from packages/core/src/modules/feature-flag/queries/list-feature-flags.ts rename to packages/core/src/modules/feature-flags/queries/list-feature-flags.ts diff --git a/packages/core/src/modules/feature-flag/use-cases/create-feature-flag.ts b/packages/core/src/modules/feature-flags/use-cases/create-feature-flag.ts similarity index 94% rename from packages/core/src/modules/feature-flag/use-cases/create-feature-flag.ts rename to packages/core/src/modules/feature-flags/use-cases/create-feature-flag.ts index 6233bfe15..d5d7053f7 100644 --- a/packages/core/src/modules/feature-flag/use-cases/create-feature-flag.ts +++ b/packages/core/src/modules/feature-flags/use-cases/create-feature-flag.ts @@ -1,7 +1,7 @@ import { db } from '@oyster/db'; import { id } from '@oyster/utils'; -import { type CreateFeatureFlagInput } from '@/modules/feature-flag/feature-flag.types'; +import { type CreateFeatureFlagInput } from '@/modules/feature-flags/feature-flags.types'; export async function createFeatureFlag(input: CreateFeatureFlagInput) { const flag = await db diff --git a/packages/core/src/modules/feature-flag/use-cases/delete-feature-flag.ts b/packages/core/src/modules/feature-flags/use-cases/delete-feature-flag.ts similarity index 100% rename from packages/core/src/modules/feature-flag/use-cases/delete-feature-flag.ts rename to packages/core/src/modules/feature-flags/use-cases/delete-feature-flag.ts diff --git a/packages/core/src/modules/feature-flag/use-cases/edit-feature-flag.ts b/packages/core/src/modules/feature-flags/use-cases/edit-feature-flag.ts similarity index 94% rename from packages/core/src/modules/feature-flag/use-cases/edit-feature-flag.ts rename to packages/core/src/modules/feature-flags/use-cases/edit-feature-flag.ts index 3fe794850..23fb01cca 100644 --- a/packages/core/src/modules/feature-flag/use-cases/edit-feature-flag.ts +++ b/packages/core/src/modules/feature-flags/use-cases/edit-feature-flag.ts @@ -1,6 +1,6 @@ import { db } from '@oyster/db'; -import { type EditFeatureFlagInput } from '@/modules/feature-flag/feature-flag.types'; +import { type EditFeatureFlagInput } from '@/modules/feature-flags/feature-flags.types'; export async function editFeatureFlag(id: string, input: EditFeatureFlagInput) { const flag = await db diff --git a/packages/core/src/modules/icebreaker/icebreaker.types.ts b/packages/core/src/modules/icebreakers/icebreakers.types.ts similarity index 100% rename from packages/core/src/modules/icebreaker/icebreaker.types.ts rename to packages/core/src/modules/icebreakers/icebreakers.types.ts diff --git a/packages/core/src/modules/icebreaker/queries/get-icebreaker-prompts.ts b/packages/core/src/modules/icebreakers/queries/get-icebreaker-prompts.ts similarity index 100% rename from packages/core/src/modules/icebreaker/queries/get-icebreaker-prompts.ts rename to packages/core/src/modules/icebreakers/queries/get-icebreaker-prompts.ts diff --git a/packages/core/src/modules/icebreaker/queries/get-icebreaker-responses.ts b/packages/core/src/modules/icebreakers/queries/get-icebreaker-responses.ts similarity index 100% rename from packages/core/src/modules/icebreaker/queries/get-icebreaker-responses.ts rename to packages/core/src/modules/icebreakers/queries/get-icebreaker-responses.ts diff --git a/packages/core/src/modules/icebreaker/use-cases/add-icebreaker-prompt.ts b/packages/core/src/modules/icebreakers/use-cases/add-icebreaker-prompt.ts similarity index 79% rename from packages/core/src/modules/icebreaker/use-cases/add-icebreaker-prompt.ts rename to packages/core/src/modules/icebreakers/use-cases/add-icebreaker-prompt.ts index b297c647c..61c3844d2 100644 --- a/packages/core/src/modules/icebreaker/use-cases/add-icebreaker-prompt.ts +++ b/packages/core/src/modules/icebreakers/use-cases/add-icebreaker-prompt.ts @@ -1,7 +1,7 @@ import { db } from '@oyster/db'; import { id } from '@oyster/utils'; -import { type AddIcebreakerPromptInput } from '../icebreaker.types'; +import { type AddIcebreakerPromptInput } from '../icebreakers.types'; export async function addIcebreakerPrompt(input: AddIcebreakerPromptInput) { await db diff --git a/packages/core/src/modules/icebreaker/use-cases/upsert-icebreaker-responses.ts b/packages/core/src/modules/icebreakers/use-cases/upsert-icebreaker-responses.ts similarity index 100% rename from packages/core/src/modules/icebreaker/use-cases/upsert-icebreaker-responses.ts rename to packages/core/src/modules/icebreakers/use-cases/upsert-icebreaker-responses.ts diff --git a/packages/core/src/modules/member/events/activation-step-completed.ts b/packages/core/src/modules/members/events/activation-step-completed.ts similarity index 98% rename from packages/core/src/modules/member/events/activation-step-completed.ts rename to packages/core/src/modules/members/events/activation-step-completed.ts index 2300bcbb9..4b7ff4c77 100644 --- a/packages/core/src/modules/member/events/activation-step-completed.ts +++ b/packages/core/src/modules/members/events/activation-step-completed.ts @@ -9,7 +9,7 @@ import { } from '@oyster/types'; import { job } from '@/infrastructure/bull'; -import { activateMember } from '@/modules/member/use-cases/activate-member'; +import { activateMember } from '@/modules/members/use-cases/activate-member'; import { ErrorWithContext } from '@/shared/errors'; // Environment Variables diff --git a/packages/core/src/modules/member/events/member-activated.ts b/packages/core/src/modules/members/events/member-activated.ts similarity index 100% rename from packages/core/src/modules/member/events/member-activated.ts rename to packages/core/src/modules/members/events/member-activated.ts diff --git a/packages/core/src/modules/member/events/member-created.ts b/packages/core/src/modules/members/events/member-created.ts similarity index 100% rename from packages/core/src/modules/member/events/member-created.ts rename to packages/core/src/modules/members/events/member-created.ts diff --git a/packages/core/src/modules/member/events/member-email-added.ts b/packages/core/src/modules/members/events/member-email-added.ts similarity index 100% rename from packages/core/src/modules/member/events/member-email-added.ts rename to packages/core/src/modules/members/events/member-email-added.ts diff --git a/packages/core/src/modules/member/events/member-primary-email-changed.ts b/packages/core/src/modules/members/events/member-primary-email-changed.ts similarity index 100% rename from packages/core/src/modules/member/events/member-primary-email-changed.ts rename to packages/core/src/modules/members/events/member-primary-email-changed.ts diff --git a/packages/core/src/modules/member/events/member-removed.ts b/packages/core/src/modules/members/events/member-removed.ts similarity index 100% rename from packages/core/src/modules/member/events/member-removed.ts rename to packages/core/src/modules/members/events/member-removed.ts diff --git a/packages/core/src/modules/member/member-email.worker.ts b/packages/core/src/modules/members/member-emails.worker.ts similarity index 100% rename from packages/core/src/modules/member/member-email.worker.ts rename to packages/core/src/modules/members/member-emails.worker.ts diff --git a/packages/core/src/modules/member/member.ts b/packages/core/src/modules/members/members.ts similarity index 100% rename from packages/core/src/modules/member/member.ts rename to packages/core/src/modules/members/members.ts diff --git a/packages/core/src/modules/member/member.types.ts b/packages/core/src/modules/members/members.types.ts similarity index 100% rename from packages/core/src/modules/member/member.types.ts rename to packages/core/src/modules/members/members.types.ts diff --git a/packages/core/src/modules/member/member.worker.ts b/packages/core/src/modules/members/members.worker.ts similarity index 95% rename from packages/core/src/modules/member/member.worker.ts rename to packages/core/src/modules/members/members.worker.ts index 5c03ff9b0..81362b346 100644 --- a/packages/core/src/modules/member/member.worker.ts +++ b/packages/core/src/modules/members/members.worker.ts @@ -7,14 +7,14 @@ import { splitArray } from '@oyster/utils'; import { job, registerWorker } from '@/infrastructure/bull'; import { StudentBullJob } from '@/infrastructure/bull.types'; -import { backfillActiveStatuses } from '@/modules/active-status/use-cases/backfill-active-statuses'; -import { createNewActiveStatuses } from '@/modules/active-status/use-cases/create-new-active-statuses'; +import { backfillActiveStatuses } from '@/modules/active-statuses/use-cases/backfill-active-statuses'; +import { createNewActiveStatuses } from '@/modules/active-statuses/use-cases/create-new-active-statuses'; import { AIRTABLE_FAMILY_BASE_ID, AIRTABLE_MEMBERS_TABLE_ID, } from '@/modules/airtable'; import { sendCompanyReviewNotifications } from '@/modules/employment/use-cases/send-company-review-notifications'; -import { sendAnniversaryEmail } from '@/modules/member/use-cases/send-anniversary-email'; +import { sendAnniversaryEmail } from '@/modules/members/use-cases/send-anniversary-email'; import { success } from '@/shared/utils/core'; import { onActivationStepCompleted } from './events/activation-step-completed'; import { onMemberActivated } from './events/member-activated'; diff --git a/packages/core/src/modules/member/profile.worker.ts b/packages/core/src/modules/members/profile.worker.ts similarity index 100% rename from packages/core/src/modules/member/profile.worker.ts rename to packages/core/src/modules/members/profile.worker.ts diff --git a/packages/core/src/modules/member/queries/get-member-by-email.ts b/packages/core/src/modules/members/queries/get-member-by-email.ts similarity index 100% rename from packages/core/src/modules/member/queries/get-member-by-email.ts rename to packages/core/src/modules/members/queries/get-member-by-email.ts diff --git a/packages/core/src/modules/member/queries/list-emails.test.ts b/packages/core/src/modules/members/queries/list-emails.test.ts similarity index 100% rename from packages/core/src/modules/member/queries/list-emails.test.ts rename to packages/core/src/modules/members/queries/list-emails.test.ts diff --git a/packages/core/src/modules/member/queries/list-emails.ts b/packages/core/src/modules/members/queries/list-emails.ts similarity index 100% rename from packages/core/src/modules/member/queries/list-emails.ts rename to packages/core/src/modules/members/queries/list-emails.ts diff --git a/packages/core/src/modules/member/queries/list-members-in-directory.ts b/packages/core/src/modules/members/queries/list-members-in-directory.ts similarity index 99% rename from packages/core/src/modules/member/queries/list-members-in-directory.ts rename to packages/core/src/modules/members/queries/list-members-in-directory.ts index 725465100..b0ba673f8 100644 --- a/packages/core/src/modules/member/queries/list-members-in-directory.ts +++ b/packages/core/src/modules/members/queries/list-members-in-directory.ts @@ -2,7 +2,7 @@ import { sql } from 'kysely'; import { db } from '@oyster/db'; -import { type ListMembersInDirectoryWhere } from '@/modules/member/member.types'; +import { type ListMembersInDirectoryWhere } from '@/modules/members/members.types'; type GetMembersOptions = { limit: number; diff --git a/packages/core/src/modules/member/use-cases/activate-member.ts b/packages/core/src/modules/members/use-cases/activate-member.ts similarity index 100% rename from packages/core/src/modules/member/use-cases/activate-member.ts rename to packages/core/src/modules/members/use-cases/activate-member.ts diff --git a/packages/core/src/modules/member/use-cases/backfill-engagement-records.ts b/packages/core/src/modules/members/use-cases/backfill-engagement-records.ts similarity index 100% rename from packages/core/src/modules/member/use-cases/backfill-engagement-records.ts rename to packages/core/src/modules/members/use-cases/backfill-engagement-records.ts diff --git a/packages/core/src/modules/member/use-cases/change-primary-email.ts b/packages/core/src/modules/members/use-cases/change-primary-email.ts similarity index 93% rename from packages/core/src/modules/member/use-cases/change-primary-email.ts rename to packages/core/src/modules/members/use-cases/change-primary-email.ts index 5aaf7139e..6c5054ac7 100644 --- a/packages/core/src/modules/member/use-cases/change-primary-email.ts +++ b/packages/core/src/modules/members/use-cases/change-primary-email.ts @@ -1,7 +1,7 @@ import { db } from '@oyster/db'; import { job } from '@/infrastructure/bull'; -import { type ChangePrimaryEmailInput } from '@/modules/member/member.types'; +import { type ChangePrimaryEmailInput } from '@/modules/members/members.types'; /** * Changes the primary email of a member. This also emits an event to process diff --git a/packages/core/src/modules/member/use-cases/join-member-directory.ts b/packages/core/src/modules/members/use-cases/join-member-directory.ts similarity index 100% rename from packages/core/src/modules/member/use-cases/join-member-directory.ts rename to packages/core/src/modules/members/use-cases/join-member-directory.ts diff --git a/packages/core/src/modules/member/use-cases/send-anniversary-email.ts b/packages/core/src/modules/members/use-cases/send-anniversary-email.ts similarity index 100% rename from packages/core/src/modules/member/use-cases/send-anniversary-email.ts rename to packages/core/src/modules/members/use-cases/send-anniversary-email.ts diff --git a/packages/core/src/modules/member/use-cases/send-birthday-notification.ts b/packages/core/src/modules/members/use-cases/send-birthday-notification.ts similarity index 100% rename from packages/core/src/modules/member/use-cases/send-birthday-notification.ts rename to packages/core/src/modules/members/use-cases/send-birthday-notification.ts diff --git a/packages/core/src/modules/member/use-cases/send-profile-views-notification.ts b/packages/core/src/modules/members/use-cases/send-profile-views-notification.ts similarity index 100% rename from packages/core/src/modules/member/use-cases/send-profile-views-notification.ts rename to packages/core/src/modules/members/use-cases/send-profile-views-notification.ts diff --git a/packages/core/src/modules/member/use-cases/update-allow-email-share.ts b/packages/core/src/modules/members/use-cases/update-allow-email-share.ts similarity index 100% rename from packages/core/src/modules/member/use-cases/update-allow-email-share.ts rename to packages/core/src/modules/members/use-cases/update-allow-email-share.ts diff --git a/packages/core/src/modules/member/use-cases/update-member-email.ts b/packages/core/src/modules/members/use-cases/update-member-email.ts similarity index 100% rename from packages/core/src/modules/member/use-cases/update-member-email.ts rename to packages/core/src/modules/members/use-cases/update-member-email.ts diff --git a/packages/core/src/modules/member/use-cases/update-member.ts b/packages/core/src/modules/members/use-cases/update-member.ts similarity index 100% rename from packages/core/src/modules/member/use-cases/update-member.ts rename to packages/core/src/modules/members/use-cases/update-member.ts diff --git a/packages/core/src/modules/member/use-cases/view-member-profile.ts b/packages/core/src/modules/members/use-cases/view-member-profile.ts similarity index 100% rename from packages/core/src/modules/member/use-cases/view-member-profile.ts rename to packages/core/src/modules/members/use-cases/view-member-profile.ts diff --git a/packages/core/src/modules/notification/notification.worker.ts b/packages/core/src/modules/notifications/notifications.worker.ts similarity index 94% rename from packages/core/src/modules/notification/notification.worker.ts rename to packages/core/src/modules/notifications/notifications.worker.ts index 8570e0402..68afe6e66 100644 --- a/packages/core/src/modules/notification/notification.worker.ts +++ b/packages/core/src/modules/notifications/notifications.worker.ts @@ -2,7 +2,7 @@ import { match } from 'ts-pattern'; import { registerWorker } from '@/infrastructure/bull'; import { NotificationBullJob } from '@/infrastructure/bull.types'; -import { sendEphemeralSlackNotification } from '@/modules/notification/use-cases/send-ephemeral-slack-notification'; +import { sendEphemeralSlackNotification } from '@/modules/notifications/use-cases/send-ephemeral-slack-notification'; import { sendEmail } from './use-cases/send-email'; import { sendSlackNotification } from './use-cases/send-slack-notification'; diff --git a/packages/core/src/modules/notification/shared/email.utils.ts b/packages/core/src/modules/notifications/shared/email.utils.ts similarity index 100% rename from packages/core/src/modules/notification/shared/email.utils.ts rename to packages/core/src/modules/notifications/shared/email.utils.ts diff --git a/packages/core/src/modules/notification/use-cases/send-email.ts b/packages/core/src/modules/notifications/use-cases/send-email.ts similarity index 100% rename from packages/core/src/modules/notification/use-cases/send-email.ts rename to packages/core/src/modules/notifications/use-cases/send-email.ts diff --git a/packages/core/src/modules/notification/use-cases/send-ephemeral-slack-notification.ts b/packages/core/src/modules/notifications/use-cases/send-ephemeral-slack-notification.ts similarity index 83% rename from packages/core/src/modules/notification/use-cases/send-ephemeral-slack-notification.ts rename to packages/core/src/modules/notifications/use-cases/send-ephemeral-slack-notification.ts index 02921bd7d..ed55ff6d8 100644 --- a/packages/core/src/modules/notification/use-cases/send-ephemeral-slack-notification.ts +++ b/packages/core/src/modules/notifications/use-cases/send-ephemeral-slack-notification.ts @@ -1,4 +1,4 @@ -import { isFeatureFlagEnabled } from '@/modules/feature-flag/queries/is-feature-flag-enabled'; +import { isFeatureFlagEnabled } from '@/modules/feature-flags/queries/is-feature-flag-enabled'; import { slack } from '@/modules/slack/instances'; type SendNotificationInput = { diff --git a/packages/core/src/modules/notification/use-cases/send-slack-notification.ts b/packages/core/src/modules/notifications/use-cases/send-slack-notification.ts similarity index 90% rename from packages/core/src/modules/notification/use-cases/send-slack-notification.ts rename to packages/core/src/modules/notifications/use-cases/send-slack-notification.ts index 6b2a6a5c7..9a74c9e1a 100644 --- a/packages/core/src/modules/notification/use-cases/send-slack-notification.ts +++ b/packages/core/src/modules/notifications/use-cases/send-slack-notification.ts @@ -1,4 +1,4 @@ -import { isFeatureFlagEnabled } from '@/modules/feature-flag/queries/is-feature-flag-enabled'; +import { isFeatureFlagEnabled } from '@/modules/feature-flags/queries/is-feature-flag-enabled'; import { internalSlack, slack } from '@/modules/slack/instances'; const INTERNAL_SLACK_NOTIFICATIONS_CHANNEL_ID = process.env diff --git a/packages/core/src/modules/onboarding-session/events/onboarding-session-attended.ts b/packages/core/src/modules/onboarding-sessions/events/onboarding-session-attended.ts similarity index 100% rename from packages/core/src/modules/onboarding-session/events/onboarding-session-attended.ts rename to packages/core/src/modules/onboarding-sessions/events/onboarding-session-attended.ts diff --git a/packages/core/src/modules/onboarding-session/onboarding-session.types.ts b/packages/core/src/modules/onboarding-sessions/onboarding-sessions.types.ts similarity index 100% rename from packages/core/src/modules/onboarding-session/onboarding-session.types.ts rename to packages/core/src/modules/onboarding-sessions/onboarding-sessions.types.ts diff --git a/packages/core/src/modules/onboarding-session/onboarding-session.worker.ts b/packages/core/src/modules/onboarding-sessions/onboarding-sessions.worker.ts similarity index 100% rename from packages/core/src/modules/onboarding-session/onboarding-session.worker.ts rename to packages/core/src/modules/onboarding-sessions/onboarding-sessions.worker.ts diff --git a/packages/core/src/modules/onboarding-session/use-cases/add-onboarding-session-attendees.ts b/packages/core/src/modules/onboarding-sessions/use-cases/add-onboarding-session-attendees.ts similarity index 100% rename from packages/core/src/modules/onboarding-session/use-cases/add-onboarding-session-attendees.ts rename to packages/core/src/modules/onboarding-sessions/use-cases/add-onboarding-session-attendees.ts diff --git a/packages/core/src/modules/onboarding-session/use-cases/upload-onboarding-session.ts b/packages/core/src/modules/onboarding-sessions/use-cases/upload-onboarding-session.ts similarity index 100% rename from packages/core/src/modules/onboarding-session/use-cases/upload-onboarding-session.ts rename to packages/core/src/modules/onboarding-sessions/use-cases/upload-onboarding-session.ts diff --git a/packages/core/src/modules/opportunity.ts b/packages/core/src/modules/opportunities.ts similarity index 100% rename from packages/core/src/modules/opportunity.ts rename to packages/core/src/modules/opportunities.ts diff --git a/packages/core/src/modules/referral/referral.ts b/packages/core/src/modules/referrals/referrals.ts similarity index 96% rename from packages/core/src/modules/referral/referral.ts rename to packages/core/src/modules/referrals/referrals.ts index 0ce21e30c..e7c29b9bd 100644 --- a/packages/core/src/modules/referral/referral.ts +++ b/packages/core/src/modules/referrals/referrals.ts @@ -7,10 +7,10 @@ import { job } from '@/infrastructure/bull'; import { type ReferFriendInput, ReferralStatus, -} from '@/modules/referral/referral.types'; +} from '@/modules/referrals/referrals.types'; import { STUDENT_PROFILE_URL } from '@/shared/env'; -export { ReferFriendInput } from '@/modules/referral/referral.types'; +export { ReferFriendInput } from '@/modules/referrals/referrals.types'; // Queries diff --git a/packages/core/src/modules/referral/referral.types.ts b/packages/core/src/modules/referrals/referrals.types.ts similarity index 100% rename from packages/core/src/modules/referral/referral.types.ts rename to packages/core/src/modules/referrals/referrals.types.ts diff --git a/packages/core/src/modules/referral/referral.ui.tsx b/packages/core/src/modules/referrals/referrals.ui.tsx similarity index 90% rename from packages/core/src/modules/referral/referral.ui.tsx rename to packages/core/src/modules/referrals/referrals.ui.tsx index abd87a462..f51995b20 100644 --- a/packages/core/src/modules/referral/referral.ui.tsx +++ b/packages/core/src/modules/referrals/referrals.ui.tsx @@ -2,9 +2,9 @@ import { Form } from '@remix-run/react'; import { Button, ErrorMessage, Field, Input } from '@oyster/ui'; -import { ReferFriendInput } from '@/modules/referral/referral.types'; +import { ReferFriendInput } from '@/modules/referrals/referrals.types'; -export { ReferralStatus } from './referral.types'; +export { ReferralStatus } from './referrals.types'; const keys = ReferFriendInput.keyof().enum; diff --git a/packages/core/src/modules/resource/index.server.ts b/packages/core/src/modules/resources/index.server.ts similarity index 100% rename from packages/core/src/modules/resource/index.server.ts rename to packages/core/src/modules/resources/index.server.ts diff --git a/packages/core/src/modules/resource/index.ts b/packages/core/src/modules/resources/index.ts similarity index 86% rename from packages/core/src/modules/resource/index.ts rename to packages/core/src/modules/resources/index.ts index beeccf28a..ded8832c4 100644 --- a/packages/core/src/modules/resource/index.ts +++ b/packages/core/src/modules/resources/index.ts @@ -7,4 +7,4 @@ export { ResourceType, UpdateResourceInput, UpvoteResourceInput, -} from './resource.types'; +} from './resources.types'; diff --git a/packages/core/src/modules/resource/queries/get-resource.ts b/packages/core/src/modules/resources/queries/get-resource.ts similarity index 94% rename from packages/core/src/modules/resource/queries/get-resource.ts rename to packages/core/src/modules/resources/queries/get-resource.ts index a4fa0b210..22ad6931e 100644 --- a/packages/core/src/modules/resource/queries/get-resource.ts +++ b/packages/core/src/modules/resources/queries/get-resource.ts @@ -5,7 +5,7 @@ import { db, type DB } from '@oyster/db'; import { buildAttachmentsField, buildTagsField, -} from '@/modules/resource/shared'; +} from '@/modules/resources/shared'; type GetResourceOptions = { select: Selection[]; diff --git a/packages/core/src/modules/resource/queries/list-resources.ts b/packages/core/src/modules/resources/queries/list-resources.ts similarity index 98% rename from packages/core/src/modules/resource/queries/list-resources.ts rename to packages/core/src/modules/resources/queries/list-resources.ts index d7aaab798..cc81f4e3d 100644 --- a/packages/core/src/modules/resource/queries/list-resources.ts +++ b/packages/core/src/modules/resources/queries/list-resources.ts @@ -5,11 +5,11 @@ import { db, type DB } from '@oyster/db'; import { type ListResourcesOrderBy, type ListResourcesWhere, -} from '@/modules/resource/resource.types'; +} from '@/modules/resources/resources.types'; import { buildAttachmentsField, buildTagsField, -} from '@/modules/resource/shared'; +} from '@/modules/resources/shared'; import { type ListSearchParams } from '@/shared/types'; type ListResourcesOptions = { diff --git a/packages/core/src/modules/resource/queries/list-tags.ts b/packages/core/src/modules/resources/queries/list-tags.ts similarity index 100% rename from packages/core/src/modules/resource/queries/list-tags.ts rename to packages/core/src/modules/resources/queries/list-tags.ts diff --git a/packages/core/src/modules/resource/resource.types.ts b/packages/core/src/modules/resources/resources.types.ts similarity index 100% rename from packages/core/src/modules/resource/resource.types.ts rename to packages/core/src/modules/resources/resources.types.ts diff --git a/packages/core/src/modules/resource/shared/index.ts b/packages/core/src/modules/resources/shared/index.ts similarity index 100% rename from packages/core/src/modules/resource/shared/index.ts rename to packages/core/src/modules/resources/shared/index.ts diff --git a/packages/core/src/modules/resource/use-cases/add-resource.ts b/packages/core/src/modules/resources/use-cases/add-resource.ts similarity index 95% rename from packages/core/src/modules/resource/use-cases/add-resource.ts rename to packages/core/src/modules/resources/use-cases/add-resource.ts index 9024e1a81..96675b316 100644 --- a/packages/core/src/modules/resource/use-cases/add-resource.ts +++ b/packages/core/src/modules/resources/use-cases/add-resource.ts @@ -3,7 +3,7 @@ import { id } from '@oyster/utils'; import { job } from '@/infrastructure/bull'; import { putObject } from '@/infrastructure/s3'; -import { type AddResourceInput } from '@/modules/resource/resource.types'; +import { type AddResourceInput } from '@/modules/resources/resources.types'; export async function addResource(input: AddResourceInput) { const result = await db.transaction().execute(async (trx) => { diff --git a/packages/core/src/modules/resource/use-cases/create-tag.ts b/packages/core/src/modules/resources/use-cases/create-tag.ts similarity index 83% rename from packages/core/src/modules/resource/use-cases/create-tag.ts rename to packages/core/src/modules/resources/use-cases/create-tag.ts index 9915869b9..edfe63f76 100644 --- a/packages/core/src/modules/resource/use-cases/create-tag.ts +++ b/packages/core/src/modules/resources/use-cases/create-tag.ts @@ -1,6 +1,6 @@ import { db } from '@oyster/db'; -import { type CreateTagInput } from '@/modules/resource/resource.types'; +import { type CreateTagInput } from '@/modules/resources/resources.types'; export async function createTag(input: CreateTagInput) { const result = await db.transaction().execute(async (trx) => { diff --git a/packages/core/src/modules/resource/use-cases/downvote-resource.ts b/packages/core/src/modules/resources/use-cases/downvote-resource.ts similarity index 89% rename from packages/core/src/modules/resource/use-cases/downvote-resource.ts rename to packages/core/src/modules/resources/use-cases/downvote-resource.ts index 051501e80..5c11b9cfc 100644 --- a/packages/core/src/modules/resource/use-cases/downvote-resource.ts +++ b/packages/core/src/modules/resources/use-cases/downvote-resource.ts @@ -1,7 +1,7 @@ import { db } from '@oyster/db'; import { job } from '@/infrastructure/bull'; -import { type DownvoteResourceInput } from '@/modules/resource/resource.types'; +import { type DownvoteResourceInput } from '@/modules/resources/resources.types'; export async function downvoteResource( id: string, diff --git a/packages/core/src/modules/resource/use-cases/update-resource.ts b/packages/core/src/modules/resources/use-cases/update-resource.ts similarity index 97% rename from packages/core/src/modules/resource/use-cases/update-resource.ts rename to packages/core/src/modules/resources/use-cases/update-resource.ts index e5a384910..57c32da75 100644 --- a/packages/core/src/modules/resource/use-cases/update-resource.ts +++ b/packages/core/src/modules/resources/use-cases/update-resource.ts @@ -2,7 +2,7 @@ import { db } from '@oyster/db'; import { id } from '@oyster/utils'; import { deleteObject, putObject } from '@/infrastructure/s3'; -import { type UpdateResourceInput } from '@/modules/resource/resource.types'; +import { type UpdateResourceInput } from '@/modules/resources/resources.types'; export async function updateResource( resourceId: string, diff --git a/packages/core/src/modules/resource/use-cases/upvote-resource.ts b/packages/core/src/modules/resources/use-cases/upvote-resource.ts similarity index 90% rename from packages/core/src/modules/resource/use-cases/upvote-resource.ts rename to packages/core/src/modules/resources/use-cases/upvote-resource.ts index 5db5ecbb3..53f6f6012 100644 --- a/packages/core/src/modules/resource/use-cases/upvote-resource.ts +++ b/packages/core/src/modules/resources/use-cases/upvote-resource.ts @@ -1,7 +1,7 @@ import { db } from '@oyster/db'; import { job } from '@/infrastructure/bull'; -import { type UpvoteResourceInput } from '@/modules/resource/resource.types'; +import { type UpvoteResourceInput } from '@/modules/resources/resources.types'; export async function upvoteResource(id: string, input: UpvoteResourceInput) { const result = await db.transaction().execute(async (trx) => { diff --git a/packages/core/src/modules/resource/use-cases/view-resource.ts b/packages/core/src/modules/resources/use-cases/view-resource.ts similarity index 83% rename from packages/core/src/modules/resource/use-cases/view-resource.ts rename to packages/core/src/modules/resources/use-cases/view-resource.ts index bb8f7f5d7..4d4668eb9 100644 --- a/packages/core/src/modules/resource/use-cases/view-resource.ts +++ b/packages/core/src/modules/resources/use-cases/view-resource.ts @@ -1,6 +1,6 @@ import { db } from '@oyster/db'; -import { type ViewResourceInput } from '@/modules/resource/resource.types'; +import { type ViewResourceInput } from '@/modules/resources/resources.types'; export async function viewResource(id: string, input: ViewResourceInput) { const result = await db.transaction().execute(async (trx) => { diff --git a/packages/core/src/modules/resume-book/resume-book.ts b/packages/core/src/modules/resume-books/resume-books.ts similarity index 99% rename from packages/core/src/modules/resume-book/resume-book.ts rename to packages/core/src/modules/resume-books/resume-books.ts index 4511c8596..73fb11126 100644 --- a/packages/core/src/modules/resume-book/resume-book.ts +++ b/packages/core/src/modules/resume-books/resume-books.ts @@ -26,7 +26,7 @@ import { RESUME_BOOK_ROLES, type SubmitResumeInput, type UpdateResumeBookInput, -} from '@/modules/resume-book/resume-book.types'; +} from '@/modules/resume-books/resume-books.types'; import { ColorStackError } from '@/shared/errors'; import { success } from '@/shared/utils/core'; diff --git a/packages/core/src/modules/resume-book/resume-book.types.ts b/packages/core/src/modules/resume-books/resume-books.types.ts similarity index 100% rename from packages/core/src/modules/resume-book/resume-book.types.ts rename to packages/core/src/modules/resume-books/resume-books.types.ts diff --git a/packages/core/src/modules/resume-book/resume-book.ui.tsx b/packages/core/src/modules/resume-books/resume-books.ui.tsx similarity index 97% rename from packages/core/src/modules/resume-book/resume-book.ui.tsx rename to packages/core/src/modules/resume-books/resume-books.ui.tsx index 9df07fbe3..95ef8c5bb 100644 --- a/packages/core/src/modules/resume-book/resume-book.ui.tsx +++ b/packages/core/src/modules/resume-books/resume-books.ui.tsx @@ -1,6 +1,6 @@ import { DatePicker, Field, type FieldProps, Input, Radio } from '@oyster/ui'; -import { ResumeBook } from '@/modules/resume-book/resume-book.types'; +import { ResumeBook } from '@/modules/resume-books/resume-books.types'; const keys = ResumeBook.keyof().enum; diff --git a/packages/core/src/modules/resume-review.ts b/packages/core/src/modules/resume-reviews.ts similarity index 100% rename from packages/core/src/modules/resume-review.ts rename to packages/core/src/modules/resume-reviews.ts diff --git a/packages/core/src/modules/slack/events/slack-workspace-joined.ts b/packages/core/src/modules/slack/events/slack-workspace-joined.ts index e8cb2cdb1..dd3bac584 100644 --- a/packages/core/src/modules/slack/events/slack-workspace-joined.ts +++ b/packages/core/src/modules/slack/events/slack-workspace-joined.ts @@ -1,7 +1,7 @@ import { db } from '@oyster/db'; import { type GetBullJobData } from '@/infrastructure/bull.types'; -import { getMemberByEmail } from '@/modules/member/queries/get-member-by-email'; +import { getMemberByEmail } from '@/modules/members/queries/get-member-by-email'; import { addDirectoryLinkToSlackProfile } from '@/modules/slack/slack-profile'; import { NotFoundError } from '@/shared/errors'; diff --git a/packages/core/src/modules/slack/slack.ts b/packages/core/src/modules/slack/slack.ts index a5c53146a..8a3220e35 100644 --- a/packages/core/src/modules/slack/slack.ts +++ b/packages/core/src/modules/slack/slack.ts @@ -15,7 +15,7 @@ import { job } from '@/infrastructure/bull'; import { track } from '@/infrastructure/mixpanel'; import { getPineconeIndex } from '@/infrastructure/pinecone'; import { cache, ONE_HOUR_IN_SECONDS } from '@/infrastructure/redis'; -import { sendSlackNotification } from '@/modules/notification/use-cases/send-slack-notification'; +import { sendSlackNotification } from '@/modules/notifications/use-cases/send-slack-notification'; import { slack } from '@/modules/slack/instances'; import { IS_PRODUCTION } from '@/shared/env'; import { fail, type Result, success } from '@/shared/utils/core'; diff --git a/packages/core/src/modules/slack/use-cases/add-slack-message.ts b/packages/core/src/modules/slack/use-cases/add-slack-message.ts index a360cf654..76e802b30 100644 --- a/packages/core/src/modules/slack/use-cases/add-slack-message.ts +++ b/packages/core/src/modules/slack/use-cases/add-slack-message.ts @@ -3,7 +3,7 @@ import { db } from '@oyster/db'; import { job } from '@/infrastructure/bull'; import { type GetBullJobData } from '@/infrastructure/bull.types'; import { redis } from '@/infrastructure/redis'; -import { isFeatureFlagEnabled } from '@/modules/feature-flag/queries/is-feature-flag-enabled'; +import { isFeatureFlagEnabled } from '@/modules/feature-flags/queries/is-feature-flag-enabled'; import { slack } from '@/modules/slack/instances'; import { ErrorWithContext } from '@/shared/errors'; import { retryWithBackoff } from '@/shared/utils/core'; From 91e80053d747592b98ecc709da2e6f21fc9e5d73 Mon Sep 17 00:00:00 2001 From: Abdulmajeed Kabala <157870574+AbdulmajeedKabala@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:06:39 -0500 Subject: [PATCH 3/9] =?UTF-8?q?feat:=20add=20confirmation=20that=20user=20?= =?UTF-8?q?has=20searched=20for=20duplicate=20resources=20=E2=9C=85=20=20(?= =?UTF-8?q?#612)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/routes/_profile.resources.add.tsx | 2 ++ .../app/shared/components/resource-form.tsx | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/apps/member-profile/app/routes/_profile.resources.add.tsx b/apps/member-profile/app/routes/_profile.resources.add.tsx index 283d73c0a..e8608fa73 100644 --- a/apps/member-profile/app/routes/_profile.resources.add.tsx +++ b/apps/member-profile/app/routes/_profile.resources.add.tsx @@ -28,6 +28,7 @@ import { ResourceDescriptionField, ResourceLinkField, ResourceProvider, + ResourceSearchConfirmationField, ResourceTagsField, ResourceTitleField, ResourceTypeField, @@ -121,6 +122,7 @@ export default function AddResourceModal() {
+ ) { + return ( + + ); +} + export function ResourceTagsField({ defaultValue, error, From 5ac3541908be63998cee9d7aede33f7202b99994 Mon Sep 17 00:00:00 2001 From: "Boris Hernandez Jr." <108431983+Boris713@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:01:19 -0600 Subject: [PATCH 4/9] =?UTF-8?q?feat:=20implement=20delete=20resource=20fun?= =?UTF-8?q?ctionality=20=F0=9F=95=B3=EF=B8=8F=F0=9F=91=A8=E2=80=8D?= =?UTF-8?q?=F0=9F=A6=AF=20(#615)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../routes/_profile.resources.$id_.delete.tsx | 96 ++++++++++ .../routes/_profile.resources.$id_.edit.tsx | 15 +- apps/member-profile/app/shared/constants.ts | 1 + .../src/modules/resources/index.server.ts | 1 + .../resources/use-cases/delete-resource.ts | 21 +++ .../20241210235120_resource_cascade_delete.ts | 168 ++++++++++++++++++ 6 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 apps/member-profile/app/routes/_profile.resources.$id_.delete.tsx create mode 100644 packages/core/src/modules/resources/use-cases/delete-resource.ts create mode 100644 packages/db/src/migrations/20241210235120_resource_cascade_delete.ts diff --git a/apps/member-profile/app/routes/_profile.resources.$id_.delete.tsx b/apps/member-profile/app/routes/_profile.resources.$id_.delete.tsx new file mode 100644 index 000000000..d0dc6d8a7 --- /dev/null +++ b/apps/member-profile/app/routes/_profile.resources.$id_.delete.tsx @@ -0,0 +1,96 @@ +import { + type ActionFunctionArgs, + json, + type LoaderFunctionArgs, + redirect, +} from '@remix-run/node'; +import { + Form, + useActionData, + useLoaderData, + useSearchParams, +} from '@remix-run/react'; + +import { deleteResource } from '@oyster/core/resources/server'; +import { db } from '@oyster/db'; +import { Button, ErrorMessage, getErrors, Modal } from '@oyster/ui'; + +import { Route } from '@/shared/constants'; +import { + commitSession, + ensureUserAuthenticated, + toast, + user, +} from '@/shared/session.server'; + +export async function loader({ params, request }: LoaderFunctionArgs) { + const session = await ensureUserAuthenticated(request); + + const resource = await db + .selectFrom('resources') + .select(['title']) + .where('id', '=', params.id as string) + .where('postedBy', '=', user(session)) + .executeTakeFirst(); + + if (!resource) { + throw new Response(null, { + status: 404, + statusText: 'The resource you are looking for does not exist.', + }); + } + + return json(resource); +} + +export async function action({ params, request }: ActionFunctionArgs) { + const session = await ensureUserAuthenticated(request); + + await deleteResource(params.id as string); + + toast(session, { + message: 'Resource deleted successfully.', + }); + + const url = new URL(request.url); + + url.pathname = Route['/resources']; + + return redirect(url.toString(), { + headers: { + 'Set-Cookie': await commitSession(session), + }, + }); +} + +export default function DeleteResourceModal() { + const { title } = useLoaderData(); + const { error } = getErrors(useActionData()); + const [searchParams] = useSearchParams(); + + return ( + + + Delete Resource + + + + + Are you sure you want to delete "{title}"? This action cannot be undone. + + + + {error} + + + Delete + + + + ); +} diff --git a/apps/member-profile/app/routes/_profile.resources.$id_.edit.tsx b/apps/member-profile/app/routes/_profile.resources.$id_.edit.tsx index 4f244c36d..c428ebc28 100644 --- a/apps/member-profile/app/routes/_profile.resources.$id_.edit.tsx +++ b/apps/member-profile/app/routes/_profile.resources.$id_.edit.tsx @@ -10,6 +10,8 @@ import { } from '@remix-run/node'; import { Form, + generatePath, + Link, useActionData, useLoaderData, useSearchParams, @@ -21,6 +23,7 @@ import { Button, Divider, ErrorMessage, + getButtonCn, getErrors, Modal, validateForm, @@ -47,6 +50,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) { const record = await getResource({ select: [ 'resources.description', + 'resources.id', 'resources.link', 'resources.title', 'resources.type', @@ -170,8 +174,17 @@ export default function EditResourceModal() { {error} - + Save + + + Delete + diff --git a/apps/member-profile/app/shared/constants.ts b/apps/member-profile/app/shared/constants.ts index 7c02f3683..abfb5a540 100644 --- a/apps/member-profile/app/shared/constants.ts +++ b/apps/member-profile/app/shared/constants.ts @@ -72,6 +72,7 @@ const ROUTES = [ '/recap/:date/reviews', '/resources', '/resources/add', + '/resources/:id/delete', '/resources/:id/edit', '/resume/review', '/resume-books/:id', diff --git a/packages/core/src/modules/resources/index.server.ts b/packages/core/src/modules/resources/index.server.ts index eb78312bd..e11cec0eb 100644 --- a/packages/core/src/modules/resources/index.server.ts +++ b/packages/core/src/modules/resources/index.server.ts @@ -3,6 +3,7 @@ export { listResources } from './queries/list-resources'; export { listTags } from './queries/list-tags'; export { addResource } from './use-cases/add-resource'; export { createTag } from './use-cases/create-tag'; +export { deleteResource } from './use-cases/delete-resource'; export { downvoteResource } from './use-cases/downvote-resource'; export { updateResource } from './use-cases/update-resource'; export { upvoteResource } from './use-cases/upvote-resource'; diff --git a/packages/core/src/modules/resources/use-cases/delete-resource.ts b/packages/core/src/modules/resources/use-cases/delete-resource.ts new file mode 100644 index 000000000..c54955614 --- /dev/null +++ b/packages/core/src/modules/resources/use-cases/delete-resource.ts @@ -0,0 +1,21 @@ +import { db } from '@oyster/db'; + +import { deleteObject } from '@/infrastructure/s3'; + +export async function deleteResource(id: string) { + const attachments = await db + .selectFrom('resourceAttachments') + .select(['objectKey']) + .where('resourceId', '=', id) + .execute(); + + await db.transaction().execute(async (trx) => { + await trx.deleteFrom('resources').where('id', '=', id).execute(); + }); + + for (const attachment of attachments) { + await deleteObject({ + key: attachment.objectKey, + }); + } +} diff --git a/packages/db/src/migrations/20241210235120_resource_cascade_delete.ts b/packages/db/src/migrations/20241210235120_resource_cascade_delete.ts new file mode 100644 index 000000000..dbfbaf95a --- /dev/null +++ b/packages/db/src/migrations/20241210235120_resource_cascade_delete.ts @@ -0,0 +1,168 @@ +import { type Kysely } from 'kysely'; + +export async function up(db: Kysely) { + // Drop current foreign key constraints. + + await db.schema + .alterTable('resource_attachments') + .dropConstraint('resource_attachments_resource_id_fkey') + .execute(); + + await db.schema + .alterTable('resource_tags') + .dropConstraint('resource_tags_resource_id_fkey') + .execute(); + + await db.schema + .alterTable('resource_upvotes') + .dropConstraint('resource_upvotes_resource_id_fkey') + .execute(); + + await db.schema + .alterTable('resource_views') + .dropConstraint('resource_views_resource_id_fkey') + .execute(); + + await db.schema + .alterTable('completed_activities') + .dropConstraint('completed_activities_resource_id_fkey') + .execute(); + + // Add constraints back with cascade delete. + + await db.schema + .alterTable('resource_attachments') + .addForeignKeyConstraint( + 'resource_attachments_resource_id_fkey', + ['resource_id'], + 'resources', + ['id'] + ) + .onDelete('cascade') + .execute(); + + await db.schema + .alterTable('resource_tags') + .addForeignKeyConstraint( + 'resource_tags_resource_id_fkey', + ['resource_id'], + 'resources', + ['id'] + ) + .onDelete('cascade') + .execute(); + + await db.schema + .alterTable('resource_upvotes') + .addForeignKeyConstraint( + 'resource_upvotes_resource_id_fkey', + ['resource_id'], + 'resources', + ['id'] + ) + .onDelete('cascade') + .execute(); + + await db.schema + .alterTable('resource_views') + .addForeignKeyConstraint( + 'resource_views_resource_id_fkey', + ['resource_id'], + 'resources', + ['id'] + ) + .onDelete('cascade') + .execute(); + + await db.schema + .alterTable('completed_activities') + .addForeignKeyConstraint( + 'completed_activities_resource_id_fkey', + ['resource_id'], + 'resources', + ['id'] + ) + .onDelete('cascade') + .execute(); +} + +export async function down(db: Kysely) { + // Drop constraints with cascade delete. + + await db.schema + .alterTable('resource_attachments') + .dropConstraint('resource_attachments_resource_id_fkey') + .execute(); + + await db.schema + .alterTable('resource_tags') + .dropConstraint('resource_tags_resource_id_fkey') + .execute(); + + await db.schema + .alterTable('resource_upvotes') + .dropConstraint('resource_upvotes_resource_id_fkey') + .execute(); + + await db.schema + .alterTable('resource_views') + .dropConstraint('resource_views_resource_id_fkey') + .execute(); + + await db.schema + .alterTable('completed_activities') + .dropConstraint('completed_activities_resource_id_fkey') + .execute(); + + // Add constraints back with restrict delete. + + await db.schema + .alterTable('resource_attachments') + .addForeignKeyConstraint( + 'resource_attachments_resource_id_fkey', + ['resource_id'], + 'resources', + ['id'] + ) + .execute(); + + await db.schema + .alterTable('resource_tags') + .addForeignKeyConstraint( + 'resource_tags_resource_id_fkey', + ['resource_id'], + 'resources', + ['id'] + ) + .execute(); + + await db.schema + .alterTable('resource_upvotes') + .addForeignKeyConstraint( + 'resource_upvotes_resource_id_fkey', + ['resource_id'], + 'resources', + ['id'] + ) + .execute(); + + await db.schema + .alterTable('resource_views') + .addForeignKeyConstraint( + 'resource_views_resource_id_fkey', + ['resource_id'], + 'resources', + ['id'] + ) + .execute(); + + await db.schema + .alterTable('completed_activities') + .addForeignKeyConstraint( + 'completed_activities_resource_id_fkey', + ['resource_id'], + 'resources', + ['id'] + ) + .execute(); +} From 68861fcf0a397ad523fd9ef490995c38f9be3b93 Mon Sep 17 00:00:00 2001 From: Rami Abdou <38056800+ramiAbdou@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:37:27 -0800 Subject: [PATCH 5/9] =?UTF-8?q?feat:=20implement=20select=20component=20(v?= =?UTF-8?q?2)=20using=20radix=20=F0=9F=9A=80=20(#665)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui/package.json | 2 + packages/ui/src/components/select.tsx | 3 + packages/ui/src/components/select.v2.tsx | 85 ++++++++ yarn.lock | 246 ++++++++++++++++++++++- 4 files changed, 334 insertions(+), 2 deletions(-) create mode 100644 packages/ui/src/components/select.v2.tsx diff --git a/packages/ui/package.json b/packages/ui/package.json index 0a24acc70..7ab2134a0 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -9,6 +9,7 @@ "./filter": "./src/components/filter.tsx", "./index.css": "./src/index.css", "./progress": "./src/components/progress.tsx", + "./select": "./src/components/select.v2.tsx", "./tooltip": "./src/components/tooltip.tsx" }, "license": "MIT", @@ -19,6 +20,7 @@ }, "dependencies": { "@radix-ui/react-progress": "^1.1.0", + "@radix-ui/react-select": "^2.1.2", "@radix-ui/react-tooltip": "^1.0.7" }, "devDependencies": { diff --git a/packages/ui/src/components/select.tsx b/packages/ui/src/components/select.tsx index 056418aa5..eec76cde9 100644 --- a/packages/ui/src/components/select.tsx +++ b/packages/ui/src/components/select.tsx @@ -19,6 +19,9 @@ export type SelectProps = Pick< width?: 'fit'; }; +/** + * @deprecated Use the `Select` component from `@oyster/ui/select` instead. + */ export function Select({ children, defaultValue = '', diff --git a/packages/ui/src/components/select.v2.tsx b/packages/ui/src/components/select.v2.tsx new file mode 100644 index 000000000..b694433ee --- /dev/null +++ b/packages/ui/src/components/select.v2.tsx @@ -0,0 +1,85 @@ +import { + Content, + Icon, + Item, + ItemIndicator, + ItemText, + Portal, + Root, + ScrollDownButton, + ScrollUpButton, + type SelectItemProps, + type SelectProps, + type SelectTriggerProps, + type SelectValueProps, + Trigger, + Value, + Viewport, +} from '@radix-ui/react-select'; +import { Check, ChevronDown, ChevronUp } from 'react-feather'; + +import { getInputCn } from './input'; +import { cx } from '../utils/cx'; + +type Props = SelectProps & + Pick & + Pick; + +export function Select({ + children, + id, + placeholder = 'Select...', + ...props +}: Props) { + return ( + + + + + + + + + + + + + + + {children} + + + + + + + + ); +} + +export function SelectItem({ className, children, ...props }: SelectItemProps) { + return ( + + {children} + + + + + ); +} diff --git a/yarn.lock b/yarn.lock index 8c40c3f22..4a27dba01 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2053,6 +2053,11 @@ unbzip2-stream "^1.4.3" yargs "^17.7.2" +"@radix-ui/number@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/number/-/number-1.1.0.tgz#1e95610461a09cdf8bb05c152e76ca1278d5da46" + integrity sha512-V3gRzhVNU1ldS5XhAPTom1fOIo4ccrjjJgmE+LI2h/WaFpHmx0MQApT+KZHnx8abG6Avtfcz4WoEciMnpFT3HQ== + "@radix-ui/primitive@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@radix-ui/primitive/-/primitive-1.0.1.tgz#e46f9958b35d10e9f6dc71c497305c22e3e55dbd" @@ -2060,6 +2065,11 @@ dependencies: "@babel/runtime" "^7.13.10" +"@radix-ui/primitive@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/primitive/-/primitive-1.1.0.tgz#42ef83b3b56dccad5d703ae8c42919a68798bbe2" + integrity sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA== + "@radix-ui/react-arrow@1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@radix-ui/react-arrow/-/react-arrow-1.0.3.tgz#c24f7968996ed934d57fe6cde5d6ec7266e1d25d" @@ -2068,6 +2078,23 @@ "@babel/runtime" "^7.13.10" "@radix-ui/react-primitive" "1.0.3" +"@radix-ui/react-arrow@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-arrow/-/react-arrow-1.1.0.tgz#744f388182d360b86285217e43b6c63633f39e7a" + integrity sha512-FmlW1rCg7hBpEBwFbjHwCW6AmWLQM6g/v0Sn8XbP9NvmSZ2San1FpQeyPtufzOMSIx7Y4dzjlHoifhp+7NkZhw== + dependencies: + "@radix-ui/react-primitive" "2.0.0" + +"@radix-ui/react-collection@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-collection/-/react-collection-1.1.0.tgz#f18af78e46454a2360d103c2251773028b7724ed" + integrity sha512-GZsZslMJEyo1VKm5L1ZJY8tGDxZNPAoUeQUIbKeJfoi7Q4kmig5AsgLMYYuyYbfjd8fBmFORAIwYAkXMnXZgZw== + dependencies: + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.0" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-slot" "1.1.0" + "@radix-ui/react-compose-refs@1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@radix-ui/react-compose-refs/-/react-compose-refs-1.0.0.tgz#37595b1f16ec7f228d698590e78eeed18ff218ae" @@ -2099,6 +2126,16 @@ resolved "https://registry.yarnpkg.com/@radix-ui/react-context/-/react-context-1.1.0.tgz#6df8d983546cfd1999c8512f3a8ad85a6e7fcee8" integrity sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A== +"@radix-ui/react-context@1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@radix-ui/react-context/-/react-context-1.1.1.tgz#82074aa83a472353bb22e86f11bcbd1c61c4c71a" + integrity sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q== + +"@radix-ui/react-direction@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-direction/-/react-direction-1.1.0.tgz#a7d39855f4d077adc2a1922f9c353c5977a09cdc" + integrity sha512-BUuBvgThEiAXh2DWu93XsT+a3aWrGqolGlqqw5VU1kG7p/ZH2cuDlM1sRLNnY3QcBS69UIz2mcKhMxDsdewhjg== + "@radix-ui/react-dismissable-layer@1.0.5": version "1.0.5" resolved "https://registry.yarnpkg.com/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.5.tgz#3f98425b82b9068dfbab5db5fff3df6ebf48b9d4" @@ -2111,6 +2148,31 @@ "@radix-ui/react-use-callback-ref" "1.0.1" "@radix-ui/react-use-escape-keydown" "1.0.3" +"@radix-ui/react-dismissable-layer@1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.1.tgz#cbdcb739c5403382bdde5f9243042ba643883396" + integrity sha512-QSxg29lfr/xcev6kSz7MAlmDnzbP1eI/Dwn3Tp1ip0KT5CUELsxkekFEMVBEoykI3oV39hKT4TKZzBNMbcTZYQ== + dependencies: + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-callback-ref" "1.1.0" + "@radix-ui/react-use-escape-keydown" "1.1.0" + +"@radix-ui/react-focus-guards@1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.1.tgz#8635edd346304f8b42cae86b05912b61aef27afe" + integrity sha512-pSIwfrT1a6sIoDASCSpFwOasEwKTZWDw/iBdtnqKO7v6FeOzYJ7U53cPzYFVR3geGGXgVHaH+CdngrrAzqUGxg== + +"@radix-ui/react-focus-scope@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.0.tgz#ebe2891a298e0a33ad34daab2aad8dea31caf0b2" + integrity sha512-200UD8zylvEyL8Bx+z76RJnASR2gRMuxlgFCPAe/Q/679a/r0eK3MBVYMb7vZODZcffZBdob1EGnky78xmVvcA== + dependencies: + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-callback-ref" "1.1.0" + "@radix-ui/react-id@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@radix-ui/react-id/-/react-id-1.0.1.tgz#73cdc181f650e4df24f0b6a5b7aa426b912c88c0" @@ -2119,6 +2181,13 @@ "@babel/runtime" "^7.13.10" "@radix-ui/react-use-layout-effect" "1.0.1" +"@radix-ui/react-id@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-id/-/react-id-1.1.0.tgz#de47339656594ad722eb87f94a6b25f9cffae0ed" + integrity sha512-EJUrI8yYh7WOjNOqpoJaf1jlFIH2LvtgAl+YcFqNCa+4hj64ZXmPkAKOFs/ukjz3byN6bdb/AVUqHkI8/uWWMA== + dependencies: + "@radix-ui/react-use-layout-effect" "1.1.0" + "@radix-ui/react-popper@1.1.3": version "1.1.3" resolved "https://registry.yarnpkg.com/@radix-ui/react-popper/-/react-popper-1.1.3.tgz#24c03f527e7ac348fabf18c89795d85d21b00b42" @@ -2136,6 +2205,22 @@ "@radix-ui/react-use-size" "1.0.1" "@radix-ui/rect" "1.0.1" +"@radix-ui/react-popper@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-popper/-/react-popper-1.2.0.tgz#a3e500193d144fe2d8f5d5e60e393d64111f2a7a" + integrity sha512-ZnRMshKF43aBxVWPWvbj21+7TQCvhuULWJ4gNIKYpRlQt5xGRhLx66tMp8pya2UkGHTSlhpXwmjqltDYHhw7Vg== + dependencies: + "@floating-ui/react-dom" "^2.0.0" + "@radix-ui/react-arrow" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.0" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-callback-ref" "1.1.0" + "@radix-ui/react-use-layout-effect" "1.1.0" + "@radix-ui/react-use-rect" "1.1.0" + "@radix-ui/react-use-size" "1.1.0" + "@radix-ui/rect" "1.1.0" + "@radix-ui/react-portal@1.0.4": version "1.0.4" resolved "https://registry.yarnpkg.com/@radix-ui/react-portal/-/react-portal-1.0.4.tgz#df4bfd353db3b1e84e639e9c63a5f2565fb00e15" @@ -2144,6 +2229,14 @@ "@babel/runtime" "^7.13.10" "@radix-ui/react-primitive" "1.0.3" +"@radix-ui/react-portal@1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@radix-ui/react-portal/-/react-portal-1.1.2.tgz#51eb46dae7505074b306ebcb985bf65cc547d74e" + integrity sha512-WeDYLGPxJb/5EGBoedyJbT0MpoULmwnIPMJMSldkuiMsBAv7N1cRdsTWZWht9vpPOiN3qyiGAtbK2is47/uMFg== + dependencies: + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-use-layout-effect" "1.1.0" + "@radix-ui/react-presence@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@radix-ui/react-presence/-/react-presence-1.0.1.tgz#491990ba913b8e2a5db1b06b203cb24b5cdef9ba" @@ -2176,6 +2269,33 @@ "@radix-ui/react-context" "1.1.0" "@radix-ui/react-primitive" "2.0.0" +"@radix-ui/react-select@^2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@radix-ui/react-select/-/react-select-2.1.2.tgz#2346e118966db793940f6a866fd4cc5db2cc275e" + integrity sha512-rZJtWmorC7dFRi0owDmoijm6nSJH1tVw64QGiNIZ9PNLyBDtG+iAq+XGsya052At4BfarzY/Dhv9wrrUr6IMZA== + dependencies: + "@radix-ui/number" "1.1.0" + "@radix-ui/primitive" "1.1.0" + "@radix-ui/react-collection" "1.1.0" + "@radix-ui/react-compose-refs" "1.1.0" + "@radix-ui/react-context" "1.1.1" + "@radix-ui/react-direction" "1.1.0" + "@radix-ui/react-dismissable-layer" "1.1.1" + "@radix-ui/react-focus-guards" "1.1.1" + "@radix-ui/react-focus-scope" "1.1.0" + "@radix-ui/react-id" "1.1.0" + "@radix-ui/react-popper" "1.2.0" + "@radix-ui/react-portal" "1.1.2" + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/react-slot" "1.1.0" + "@radix-ui/react-use-callback-ref" "1.1.0" + "@radix-ui/react-use-controllable-state" "1.1.0" + "@radix-ui/react-use-layout-effect" "1.1.0" + "@radix-ui/react-use-previous" "1.1.0" + "@radix-ui/react-visually-hidden" "1.1.0" + aria-hidden "^1.1.1" + react-remove-scroll "2.6.0" + "@radix-ui/react-slot@1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@radix-ui/react-slot/-/react-slot-1.0.0.tgz#7fa805b99891dea1e862d8f8fbe07f4d6d0fd698" @@ -2225,6 +2345,11 @@ dependencies: "@babel/runtime" "^7.13.10" +"@radix-ui/react-use-callback-ref@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.0.tgz#bce938ca413675bc937944b0d01ef6f4a6dc5bf1" + integrity sha512-CasTfvsy+frcFkbXtSJ2Zu9JHpN8TYKxkgJGWbjiZhFivxaeW7rMeZt7QELGVLaYVfFMsKHjb7Ak0nMEe+2Vfw== + "@radix-ui/react-use-controllable-state@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.0.1.tgz#ecd2ced34e6330caf89a82854aa2f77e07440286" @@ -2233,6 +2358,13 @@ "@babel/runtime" "^7.13.10" "@radix-ui/react-use-callback-ref" "1.0.1" +"@radix-ui/react-use-controllable-state@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz#1321446857bb786917df54c0d4d084877aab04b0" + integrity sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw== + dependencies: + "@radix-ui/react-use-callback-ref" "1.1.0" + "@radix-ui/react-use-escape-keydown@1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.0.3.tgz#217b840c250541609c66f67ed7bab2b733620755" @@ -2241,6 +2373,13 @@ "@babel/runtime" "^7.13.10" "@radix-ui/react-use-callback-ref" "1.0.1" +"@radix-ui/react-use-escape-keydown@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.0.tgz#31a5b87c3b726504b74e05dac1edce7437b98754" + integrity sha512-L7vwWlR1kTTQ3oh7g1O0CBF3YCyyTj8NmhLR+phShpyA50HCfBFKVJTpshm9PzLiKmehsrQzTYTpX9HvmC9rhw== + dependencies: + "@radix-ui/react-use-callback-ref" "1.1.0" + "@radix-ui/react-use-layout-effect@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.0.1.tgz#be8c7bc809b0c8934acf6657b577daf948a75399" @@ -2248,6 +2387,16 @@ dependencies: "@babel/runtime" "^7.13.10" +"@radix-ui/react-use-layout-effect@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.0.tgz#3c2c8ce04827b26a39e442ff4888d9212268bd27" + integrity sha512-+FPE0rOdziWSrH9athwI1R0HDVbWlEhd+FR+aSDk4uWGmSJ9Z54sdZVDQPZAinJhJXwfT+qnj969mCsT2gfm5w== + +"@radix-ui/react-use-previous@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-use-previous/-/react-use-previous-1.1.0.tgz#d4dd37b05520f1d996a384eb469320c2ada8377c" + integrity sha512-Z/e78qg2YFnnXcW88A4JmTtm4ADckLno6F7OXotmkQfeuCVaKuYzqAATPhVzl3delXE7CxIV8shofPn3jPc5Og== + "@radix-ui/react-use-rect@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@radix-ui/react-use-rect/-/react-use-rect-1.0.1.tgz#fde50b3bb9fd08f4a1cd204572e5943c244fcec2" @@ -2256,6 +2405,13 @@ "@babel/runtime" "^7.13.10" "@radix-ui/rect" "1.0.1" +"@radix-ui/react-use-rect@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-use-rect/-/react-use-rect-1.1.0.tgz#13b25b913bd3e3987cc9b073a1a164bb1cf47b88" + integrity sha512-0Fmkebhr6PiseyZlYAOtLS+nb7jLmpqTrJyv61Pe68MKYW6OWdRE2kI70TaYY27u7H0lajqM3hSMMLFq18Z7nQ== + dependencies: + "@radix-ui/rect" "1.1.0" + "@radix-ui/react-use-size@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@radix-ui/react-use-size/-/react-use-size-1.0.1.tgz#1c5f5fea940a7d7ade77694bb98116fb49f870b2" @@ -2264,6 +2420,13 @@ "@babel/runtime" "^7.13.10" "@radix-ui/react-use-layout-effect" "1.0.1" +"@radix-ui/react-use-size@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-use-size/-/react-use-size-1.1.0.tgz#b4dba7fbd3882ee09e8d2a44a3eed3a7e555246b" + integrity sha512-XW3/vWuIXHa+2Uwcc2ABSfcCledmXhhQPlGbfcRXbiUQI5Icjcg19BGCZVKKInYbvUCut/ufbbLLPFC5cbb1hw== + dependencies: + "@radix-ui/react-use-layout-effect" "1.1.0" + "@radix-ui/react-visually-hidden@1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.0.3.tgz#51aed9dd0fe5abcad7dee2a234ad36106a6984ac" @@ -2272,6 +2435,13 @@ "@babel/runtime" "^7.13.10" "@radix-ui/react-primitive" "1.0.3" +"@radix-ui/react-visually-hidden@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.1.0.tgz#ad47a8572580f7034b3807c8e6740cd41038a5a2" + integrity sha512-N8MDZqtgCgG5S3aV60INAB475osJousYpZ4cTJ2cFbMpdHS5Y6loLTH8LPtkj2QN0x93J30HT/M3qJXM0+lyeQ== + dependencies: + "@radix-ui/react-primitive" "2.0.0" + "@radix-ui/rect@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@radix-ui/rect/-/rect-1.0.1.tgz#bf8e7d947671996da2e30f4904ece343bc4a883f" @@ -2279,6 +2449,11 @@ dependencies: "@babel/runtime" "^7.13.10" +"@radix-ui/rect@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@radix-ui/rect/-/rect-1.1.0.tgz#f817d1d3265ac5415dadc67edab30ae196696438" + integrity sha512-A9+lCBZoaMJlVKcRBz2YByCG+Cp2t6nAnMnNba+XiWxnj6r4JUFqfsgwocMBZU9LPtdxC6wB56ySYpc7LQIoJg== + "@react-email/button@^0.0.6": version "0.0.6" resolved "https://registry.yarnpkg.com/@react-email/button/-/button-0.0.6.tgz#3f0b84b03d2253a3a4204312755b65004c021afc" @@ -3972,6 +4147,13 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== +aria-hidden@^1.1.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/aria-hidden/-/aria-hidden-1.2.4.tgz#b78e383fdbc04d05762c78b4a25a501e736c4522" + integrity sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A== + dependencies: + tslib "^2.0.0" + arr-diff@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-1.1.0.tgz#687c32758163588fef7de7b36fabe495eb1a399a" @@ -5241,6 +5423,11 @@ detect-libc@^2.0.0: resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700" integrity sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw== +detect-node-es@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/detect-node-es/-/detect-node-es-1.1.0.tgz#163acdf643330caa0b4cd7c21e7ee7755d6fa493" + integrity sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ== + detect-package-manager@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/detect-package-manager/-/detect-package-manager-2.0.1.tgz#6b182e3ae5e1826752bfef1de9a7b828cffa50d8" @@ -6695,6 +6882,11 @@ get-intrinsic@^1.2.1, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4: has-symbols "^1.0.3" hasown "^2.0.0" +get-nonce@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/get-nonce/-/get-nonce-1.0.1.tgz#fdf3f0278073820d2ce9426c18f07481b1e0cdf3" + integrity sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q== + get-port@5.1.1, get-port@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/get-port/-/get-port-5.1.1.tgz#0469ed07563479de6efb986baf053dcd7d4e3193" @@ -7275,6 +7467,13 @@ interpret@^1.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== +invariant@^2.2.4: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + ioredis@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.3.2.tgz#9139f596f62fc9c72d873353ac5395bcf05709f7" @@ -8158,7 +8357,7 @@ longest@^1.0.1: resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" integrity sha512-k+yt5n3l48JU4k8ftnKG6V7u32wyH2NfKzeMto9F/QRE0amxy/LayxwlvjjkZEIzqR+19IrtFO8p5kB9QaYUFg== -loose-envify@^1.1.0, loose-envify@^1.4.0: +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== @@ -10386,6 +10585,25 @@ react-refresh@^0.14.0: resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.14.0.tgz#4e02825378a5f227079554d4284889354e5f553e" integrity sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ== +react-remove-scroll-bar@^2.3.6: + version "2.3.6" + resolved "https://registry.yarnpkg.com/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.6.tgz#3e585e9d163be84a010180b18721e851ac81a29c" + integrity sha512-DtSYaao4mBmX+HDo5YWYdBWQwYIQQshUV/dVxFxK+KM26Wjwp1gZ6rv6OC3oujI6Bfu6Xyg3TwK533AQutsn/g== + dependencies: + react-style-singleton "^2.2.1" + tslib "^2.0.0" + +react-remove-scroll@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/react-remove-scroll/-/react-remove-scroll-2.6.0.tgz#fb03a0845d7768a4f1519a99fdb84983b793dc07" + integrity sha512-I2U4JVEsQenxDAKaVa3VZ/JeJZe0/2DxPWL8Tj8yLKctQJQiZM52pn/GWFpSp8dftjM3pSAHVJZscAnC/y+ySQ== + dependencies: + react-remove-scroll-bar "^2.3.6" + react-style-singleton "^2.2.1" + tslib "^2.1.0" + use-callback-ref "^1.3.0" + use-sidecar "^1.1.2" + react-router-dom@6.22.3: version "6.22.3" resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.22.3.tgz#9781415667fd1361a475146c5826d9f16752a691" @@ -10401,6 +10619,15 @@ react-router@6.22.3: dependencies: "@remix-run/router" "1.15.3" +react-style-singleton@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/react-style-singleton/-/react-style-singleton-2.2.1.tgz#f99e420492b2d8f34d38308ff660b60d0b1205b4" + integrity sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g== + dependencies: + get-nonce "^1.0.0" + invariant "^2.2.4" + tslib "^2.0.0" + react-textarea-autosize@^8.5.3: version "8.5.3" resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-8.5.3.tgz#d1e9fe760178413891484847d3378706052dd409" @@ -11730,7 +11957,7 @@ tslib@^2.0.0, tslib@^2.3.1, tslib@^2.6.2: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== -tslib@^2.0.1: +tslib@^2.0.1, tslib@^2.1.0: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== @@ -12142,6 +12369,13 @@ urlpattern-polyfill@10.0.0: resolved "https://registry.yarnpkg.com/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz#f0a03a97bfb03cdf33553e5e79a2aadd22cac8ec" integrity sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg== +use-callback-ref@^1.3.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/use-callback-ref/-/use-callback-ref-1.3.2.tgz#6134c7f6ff76e2be0b56c809b17a650c942b1693" + integrity sha512-elOQwe6Q8gqZgDA8mrh44qRTQqpIHDcZ3hXTLjBe1i4ph8XpNJnO+aQf3NaG+lriLopI4HMx9VjQLfPQ6vhnoA== + dependencies: + tslib "^2.0.0" + use-composed-ref@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/use-composed-ref/-/use-composed-ref-1.3.0.tgz#3d8104db34b7b264030a9d916c5e94fbe280dbda" @@ -12159,6 +12393,14 @@ use-latest@^1.2.1: dependencies: use-isomorphic-layout-effect "^1.1.1" +use-sidecar@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/use-sidecar/-/use-sidecar-1.1.2.tgz#2f43126ba2d7d7e117aa5855e5d8f0276dfe73c2" + integrity sha512-epTbsLuzZ7lPClpz2TyryBfztm7m+28DlEv2ZCQ3MDr5ssiwyOwGH/e5F9CkfWjJ1t4clvI58yF822/GUkjjhw== + dependencies: + detect-node-es "^1.1.0" + tslib "^2.0.0" + use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" From 810547dd40e9d8d346e34763e4fb14f1172f4aaf Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 21:27:13 -0800 Subject: [PATCH 6/9] =?UTF-8?q?fix:=20handle=20DELETE=20response=20correct?= =?UTF-8?q?ly=20in=20Mailchimp=20member=20removal=20=E2=9D=97=EF=B8=8F=20(?= =?UTF-8?q?#666)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/modules/mailchimp.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/core/src/modules/mailchimp.ts b/packages/core/src/modules/mailchimp.ts index d2b23046b..754bf8323 100644 --- a/packages/core/src/modules/mailchimp.ts +++ b/packages/core/src/modules/mailchimp.ts @@ -130,13 +130,10 @@ async function removeMailchimpMember( await releaseMailchimpConnection(); - const data = await response.json(); - if (!response.ok) { const error = new Error('Failed to remove Mailchimp member.'); reportException(error, { - data, status: response.status, }); From 1db00d822240a42a29f2120dd93811230d0eed5c Mon Sep 17 00:00:00 2001 From: Rami Abdou <38056800+ramiAbdou@users.noreply.github.com> Date: Wed, 11 Dec 2024 08:53:42 -0800 Subject: [PATCH 7/9] =?UTF-8?q?chore:=20support=20popover=20`side`=20prop?= =?UTF-8?q?=20=F0=9F=93=A6=20(#668)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/src/components/combobox-popover.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/ui/src/components/combobox-popover.tsx b/packages/ui/src/components/combobox-popover.tsx index b76640233..b13a50064 100644 --- a/packages/ui/src/components/combobox-popover.tsx +++ b/packages/ui/src/components/combobox-popover.tsx @@ -47,7 +47,14 @@ export function ComboboxPopoverProvider({ children }: PropsWithChildren) { ); } -export function ComboboxPopover({ children }: PropsWithChildren) { +type ComboboxPopoverProps = PropsWithChildren<{ + side?: 'bottom' | 'top'; +}>; + +export function ComboboxPopover({ + children, + side = 'bottom', +}: ComboboxPopoverProps) { const { popoverOpen, ref } = useComboboxPopover(); const scroll = useScrollFromModal(); @@ -64,8 +71,13 @@ export function ComboboxPopover({ children }: PropsWithChildren) { return (
Date: Wed, 11 Dec 2024 09:00:38 -0800 Subject: [PATCH 8/9] =?UTF-8?q?fix:=20update=20ethnicities=20dropdown=20?= =?UTF-8?q?=E2=9B=B3=EF=B8=8F=20(#511)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member-profile/app/shared/components/ethnicity-combobox.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/member-profile/app/shared/components/ethnicity-combobox.tsx b/apps/member-profile/app/shared/components/ethnicity-combobox.tsx index 3b862b501..84a67241a 100644 --- a/apps/member-profile/app/shared/components/ethnicity-combobox.tsx +++ b/apps/member-profile/app/shared/components/ethnicity-combobox.tsx @@ -98,7 +98,7 @@ export function EthnicityMultiCombobox({ {!!countries.length && ( - +
    {countries.map((country) => { const label = `${country.flagEmoji} ${country.demonym}`; From c6334f50b7219b5f6092306e3fccaed9f91349c2 Mon Sep 17 00:00:00 2001 From: Rami Abdou <38056800+ramiAbdou@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:23:06 -0800 Subject: [PATCH 9/9] =?UTF-8?q?feat:=20notify=20feed=20channel=20when=20th?= =?UTF-8?q?read=20hits=20100=20replies=20=F0=9F=92=AC=20(#669)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../slack/use-cases/add-slack-message.ts | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/core/src/modules/slack/use-cases/add-slack-message.ts b/packages/core/src/modules/slack/use-cases/add-slack-message.ts index 76e802b30..8d223e214 100644 --- a/packages/core/src/modules/slack/use-cases/add-slack-message.ts +++ b/packages/core/src/modules/slack/use-cases/add-slack-message.ts @@ -9,6 +9,12 @@ import { ErrorWithContext } from '@/shared/errors'; import { retryWithBackoff } from '@/shared/utils/core'; import { getSlackMessage } from '../services/slack-message.service'; +// Environment Variables + +const SLACK_FEED_CHANNEL_ID = process.env.SLACK_FEED_CHANNEL_ID as string; + +// Core + type AddSlackMessageInput = GetBullJobData<'slack.message.add'>; export async function addSlackMessage(data: AddSlackMessageInput) { @@ -205,8 +211,7 @@ async function notifyBusySlackThreadIfNecessary({ const count = Number(row.count); - // We will only notify if the thread has exactly 100 replies. - if (count !== 100) { + if (count !== 100 && count !== 500) { return; } @@ -215,8 +220,22 @@ async function notifyBusySlackThreadIfNecessary({ message_ts: id, }); - job('notification.slack.send', { - message: `🚨 Heads up! This <${permalink}|thread> has over 💯 replies!`, - workspace: 'internal', - }); + if (count === 100) { + job('notification.slack.send', { + channel: SLACK_FEED_CHANNEL_ID, + message: `This <${permalink}|thread> hit 100 replies! 👀`, + workspace: 'regular', + }); + + return; + } + + if (count === 500) { + job('notification.slack.send', { + message: `This <${permalink}|thread> hit 500 replies! 🚨`, + workspace: 'internal', + }); + + return; + } }