|
1 | 1 | import { |
2 | | - applicationsCourseTable, COURSE_ROLE, courseRegistrationTable, selfServeCourseRegistrationTable, userTable, |
| 2 | + applicationsCourseTable, selfServeCourseRegistrationTable, userTable, |
3 | 3 | } from '@bluedot/db'; |
4 | 4 | import z from 'zod'; |
5 | 5 | import { TRPCError } from '@trpc/server'; |
@@ -40,29 +40,12 @@ export const ensureSelfServeRegistrationExistsProcedure = protectedProcedure |
40 | 40 | throw new TRPCError({ code: 'PRECONDITION_FAILED', message: 'User record not available yet' }); |
41 | 41 | } |
42 | 42 |
|
43 | | - const selfServeRegistration = await db.insert(selfServeCourseRegistrationTable, { |
| 43 | + return db.insert(selfServeCourseRegistrationTable, { |
44 | 44 | userId: user.id, |
45 | 45 | courseApplicationsBaseId: applicationsCourse.id, |
46 | 46 | source: source ?? null, |
47 | 47 | createdAt: new Date().toISOString(), |
48 | 48 | }); |
49 | | - |
50 | | - // Keep dual-writing the legacy row until the migration to the self-serve table (#2526) |
51 | | - // is fully complete |
52 | | - const existingLegacy = await db.getFirst(courseRegistrationTable, { |
53 | | - filter: { email: ctx.auth.email, courseId, decision: 'Accept' }, |
54 | | - }); |
55 | | - if (!existingLegacy) { |
56 | | - await db.insert(courseRegistrationTable, { |
57 | | - email: ctx.auth.email, |
58 | | - courseApplicationsBaseId: applicationsCourse.id, |
59 | | - role: COURSE_ROLE.PARTICIPANT, |
60 | | - decision: 'Accept', |
61 | | - source: source ?? null, |
62 | | - }); |
63 | | - } |
64 | | - |
65 | | - return selfServeRegistration; |
66 | 49 | }); |
67 | 50 |
|
68 | 51 | export const selfServeCourseRegistrationsRouter = router({ |
|
0 commit comments