Skip to content

Commit 0ad72eb

Browse files
committed
fix(sync): rename contributor fields in data
1 parent b8462b6 commit 0ad72eb

File tree

19 files changed

+38
-38
lines changed

19 files changed

+38
-38
lines changed

apps/web/src/routes/$lang/_content/courses/$courseId.$chapterName-$chapterId.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ function CourseChapter() {
696696
isOriginalLanguage={isOriginalLanguage}
697697
mode="light"
698698
proofreadingData={{
699-
contributors: proofreading.contributorsId,
699+
contributors: proofreading.contributorNames,
700700
reward: proofreading.reward,
701701
}}
702702
/>

apps/web/src/routes/$lang/_content/courses/$courseId/-components/course-conclusion/conclusion-finish.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,18 @@ const Credits = ({ course }: { course: JoinedCourseWithAll }) => {
121121
</h4>
122122

123123
<p className="mt-[15px] md:mt-6 label-large-20px md:display-small-32px text-black">
124-
{proofreading?.contributorsId?.length > 0
124+
{proofreading?.contributorNames?.length > 0
125125
? t('courses.details.hasBeenProofreadBy')
126126
: t('courses.details.hasNotBeenProofread')}
127127
<span className="text-darkOrange-5 label-large-20px md:display-small-32px">
128128
{' '}
129-
{proofreading?.contributorsId?.length > 0
130-
? proofreading.contributorsId.map((proofreader, index) => (
129+
{proofreading?.contributorNames?.length > 0
130+
? proofreading.contributorNames.map((proofreader, index) => (
131131
<React.Fragment key={proofreader}>
132132
<span>{proofreader}</span>
133-
{index < proofreading.contributorsId.length - 2
133+
{index < proofreading.contributorNames.length - 2
134134
? ', '
135-
: index === proofreading.contributorsId.length - 2
135+
: index === proofreading.contributorNames.length - 2
136136
? ' & '
137137
: ''}
138138
</React.Fragment>
@@ -147,7 +147,7 @@ const Credits = ({ course }: { course: JoinedCourseWithAll }) => {
147147
isOriginalLanguage={isOriginalLanguage}
148148
mode="light"
149149
proofreadingData={{
150-
contributors: proofreading?.contributorsId || [],
150+
contributors: proofreading?.contributorNames || [],
151151
reward: proofreading?.reward,
152152
}}
153153
standalone

apps/web/src/routes/$lang/_content/resources/books/$bookName-$bookId.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function Book() {
120120
isOriginalLanguage={true}
121121
mode="dark"
122122
proofreadingData={{
123-
contributors: proofreading.contributorsId,
123+
contributors: proofreading.contributorNames,
124124
reward: proofreading.reward,
125125
}}
126126
/>

apps/web/src/routes/$lang/_content/resources/conferences/$conferenceName-$conferenceId.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function Conference() {
180180
<ProofreadingProgress
181181
mode="dark"
182182
proofreadingData={{
183-
contributors: proofreading.contributorsId,
183+
contributors: proofreading.contributorNames,
184184
reward: proofreading.reward,
185185
}}
186186
isOriginalLanguage={false}

apps/web/src/routes/$lang/_content/resources/glossary/$wordId.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function GlossaryWord() {
108108
isOriginalLanguage={isOriginalLanguage}
109109
mode="dark"
110110
proofreadingData={{
111-
contributors: proofreading.contributorsId,
111+
contributors: proofreading.contributorNames,
112112
reward: proofreading.reward,
113113
}}
114114
/>

apps/web/src/routes/$lang/_content/resources/projects/$projectName-$projectId.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function Project() {
146146
isOriginalLanguage={isOriginalLanguage}
147147
mode="dark"
148148
proofreadingData={{
149-
contributors: proofreading.contributorsId,
149+
contributors: proofreading.contributorNames,
150150
reward: proofreading.reward,
151151
}}
152152
/>

apps/web/src/routes/$lang/_content/tutorials/$category/$subcategory.$name-$id.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,18 @@ const Credits = ({
183183
</h4>
184184

185185
<p className="mt-[15px] md:mt-6 label-large-20px md:display-small-32px text-black">
186-
{proofreading?.contributorsId?.length > 0
186+
{proofreading?.contributorNames?.length > 0
187187
? t('tutorials.hasBeenProofreadBy')
188188
: t('tutorials.hasNotBeenProofread')}
189189
<span className="text-darkOrange-5 label-large-20px md:display-small-32px">
190190
{' '}
191-
{proofreading?.contributorsId?.length > 0
192-
? proofreading.contributorsId.map((proofreader, index) => (
191+
{proofreading?.contributorNames?.length > 0
192+
? proofreading.contributorNames.map((proofreader, index) => (
193193
<React.Fragment key={proofreader}>
194194
<span>{proofreader}</span>
195-
{index < proofreading.contributorsId.length - 2
195+
{index < proofreading.contributorNames.length - 2
196196
? ', '
197-
: index === proofreading.contributorsId.length - 2
197+
: index === proofreading.contributorNames.length - 2
198198
? ' & '
199199
: ''}
200200
</React.Fragment>
@@ -209,7 +209,7 @@ const Credits = ({
209209
isOriginalLanguage={isOriginalLanguage}
210210
mode="light"
211211
proofreadingData={{
212-
contributors: proofreading?.contributorsId || [],
212+
contributors: proofreading?.contributorNames || [],
213213
reward: proofreading?.reward,
214214
}}
215215
standalone
@@ -458,7 +458,7 @@ function TutorialDetails() {
458458
isOriginalLanguage={isOriginalLanguage}
459459
mode="light"
460460
proofreadingData={{
461-
contributors: proofreading.contributorsId,
461+
contributors: proofreading.contributorNames,
462462
reward: proofreading.reward,
463463
}}
464464
/>

packages/schemas/src/content/proofreading.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export const proofreadingContributorSchema = createSelectSchema(
1212
);
1313
export const joinedProofreadingSchema = proofreadingSchema.merge(
1414
z.object({
15-
contributorsId: z.string().array(),
15+
contributorNames: z.string().array(),
1616
}),
1717
);

packages/service-content/src/lib/blogs/import/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { ChangedBlog } from './index.js';
99
interface BlogMain {
1010
id: string;
1111
date?: string;
12-
builder?: string;
12+
author?: string;
1313
tags?: string[];
1414
}
1515

@@ -29,7 +29,7 @@ export const createProcessMainFile = (transaction: TransactionSql) => {
2929
${parsedBlog.id},
3030
${blog.path},
3131
${blog.category},
32-
${parsedBlog.builder},
32+
${parsedBlog.author},
3333
${lastUpdated.time},
3434
${lastUpdated.commit},
3535
NOW(),

packages/service-content/src/lib/courses/import/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,8 @@ export const createUpdateCourses = ({ postgres }: Dependencies) => {
495495
RETURNING *;
496496
`.then(firstRow);
497497

498-
if (p.contributors_id) {
499-
for (const [index, contrib] of p.contributors_id.entries()) {
498+
if (p.contributor_names) {
499+
for (const [index, contrib] of p.contributor_names.entries()) {
500500
await transaction`INSERT INTO content.contributors (id) VALUES (${contrib}) ON CONFLICT DO NOTHING`;
501501
await transaction`
502502
INSERT INTO content.proofreading_contributor(proofreading_id, contributor_id, "order")

packages/service-content/src/lib/proofreadings/queries/get-proofreading.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ export const getProofreadingQuery = ({
4444
p.last_contribution_date,
4545
p.urgency,
4646
p.reward,
47-
COALESCE(c.contributors_id, ARRAY[]::text[]) AS contributors_id
47+
COALESCE(c.contributor_names, ARRAY[]::text[]) AS contributor_names
4848
FROM content.proofreading p
4949
5050
LEFT JOIN LATERAL (
51-
SELECT COALESCE(ARRAY_AGG(pc.contributor_id), ARRAY[]::text[]) AS contributors_id
51+
SELECT COALESCE(ARRAY_AGG(pc.contributor_id), ARRAY[]::text[]) AS contributor_names
5252
FROM content.proofreading_contributor pc
5353
WHERE p.id = pc.proofreading_id
5454
) c ON TRUE

packages/service-content/src/lib/resources/import/categories/bet.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ export const createProcessChangedBet = (
9393
RETURNING *;
9494
`.then(firstRow);
9595

96-
if (p.contributors_id) {
97-
for (const [index, contrib] of p.contributors_id.entries()) {
96+
if (p.contributor_names) {
97+
for (const [index, contrib] of p.contributor_names.entries()) {
9898
await transaction`INSERT INTO content.contributors (id) VALUES (${contrib}) ON CONFLICT DO NOTHING`;
9999
await transaction`
100100
INSERT INTO content.proofreading_contributor(proofreading_id, contributor_id, "order")

packages/service-content/src/lib/resources/import/categories/conferences.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ export const createProcessChangedConference = (
151151
RETURNING *;
152152
`.then(firstRow);
153153

154-
if (p.contributors_id) {
155-
for (const [index, contrib] of p.contributors_id.entries()) {
154+
if (p.contributor_names) {
155+
for (const [index, contrib] of p.contributor_names.entries()) {
156156
await transaction`INSERT INTO content.contributors (id) VALUES (${contrib}) ON CONFLICT DO NOTHING`;
157157
await transaction`
158158
INSERT INTO content.proofreading_contributor(proofreading_id, contributor_id, "order")

packages/service-content/src/lib/resources/import/categories/glossary.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ export const createProcessChangedGlossaryWord = (
7575
RETURNING *;
7676
`.then(firstRow);
7777

78-
if (p.contributors_id) {
79-
for (const [index, contrib] of p.contributors_id.entries()) {
78+
if (p.contributor_names) {
79+
for (const [index, contrib] of p.contributor_names.entries()) {
8080
await transaction`INSERT INTO content.contributors (id) VALUES (${contrib}) ON CONFLICT DO NOTHING`;
8181
await transaction`
8282
INSERT INTO content.proofreading_contributor(proofreading_id, contributor_id, "order")

packages/service-content/src/lib/resources/import/categories/newsletters.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface NewsletterMain {
1414
link?: Array<{ website?: string }>;
1515
publication_date: string;
1616
tags?: string[];
17-
contributors?: string[];
17+
contributor_names?: string[];
1818
language?: string;
1919
description?: string;
2020
}
@@ -67,7 +67,7 @@ export const createProcessChangedNewsletter = (
6767
${parsed.title || ''},
6868
${parsed.description || ''},
6969
${parsed.tags || []},
70-
${parsed.contributors || []},
70+
${parsed.contributor_names || []},
7171
${parsed.language || 'en'}
7272
)
7373
ON CONFLICT (resource_id) DO UPDATE SET

packages/service-content/src/lib/resources/import/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface ResourceDetails {
2626
}
2727

2828
export interface BaseResource {
29-
contributors?: string[];
29+
contributor_names?: string[];
3030
}
3131

3232
export interface ChangedResource extends ChangedContent {

packages/service-content/src/lib/tutorials/import/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ export const createProcessMainFile = (transaction: TransactionSql) => {
181181
RETURNING *;
182182
`.then(firstRow);
183183

184-
if (p.contributors_id) {
185-
for (const [index, contrib] of p.contributors_id.entries()) {
184+
if (p.contributor_names) {
185+
for (const [index, contrib] of p.contributor_names.entries()) {
186186
await transaction`INSERT INTO content.contributors (id) VALUES (${contrib}) ON CONFLICT DO NOTHING`;
187187
await transaction`
188188
INSERT INTO content.proofreading_contributor(proofreading_id, contributor_id, "order")

packages/service-content/src/lib/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ export interface ProofreadingEntry {
1818
language: string;
1919
last_contribution_date: string | null;
2020
urgency: number;
21-
contributors_id?: string[];
21+
contributor_names?: string[];
2222
reward: number;
2323
}

packages/types/src/generated/content/proofreading.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ export interface JoinedProofreading {
2727
lastContributionDate: Date | null;
2828
urgency: number | null;
2929
reward: number | null;
30-
contributorsId: string[];
30+
contributorNames: string[];
3131
}

0 commit comments

Comments
 (0)