Skip to content

Commit a68567f

Browse files
authored
Fix collections and projects slug (#2911)
1 parent 013f426 commit a68567f

File tree

7 files changed

+15
-14
lines changed

7 files changed

+15
-14
lines changed

Diff for: frontend/src/modules/admin/modules/collections/components/lf-collection-add.vue

+1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ const onSubmit = () => {
182182
starred: project?.starred || false,
183183
})),
184184
isLF: true,
185+
slug: form.name.toLowerCase().replace(/ /g, '-'),
185186
};
186187
if (isEditForm.value) {
187188
handleCollectionUpdate(request);

Diff for: frontend/src/modules/admin/modules/collections/components/lf-insights-projects-list-dropdown.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
@click="onOptionClick(project)"
4040
>
4141
<lf-avatar
42-
:src="project.url"
42+
:src="project.logoUrl"
4343
:name="project.name"
4444
:size="24"
4545
class="!rounded-md border border-gray-200"

Diff for: frontend/src/modules/admin/modules/collections/models/collection.model.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export interface CollectionModel {
44
id: string;
55
name: string;
66
description: string;
7+
slug: string;
78
isLF: boolean;
89
projects: InsightsProjectModel[];
910
}

Diff for: frontend/src/modules/admin/modules/insights-projects/components/lf-insights-project-add.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ const initialFormState: InsightsProjectAddFormModel = {
159159
name: '',
160160
description: '',
161161
logoUrl: '',
162+
slug: '',
162163
collectionsIds: [],
163164
organizationId: undefined,
164165
organization: {
@@ -258,7 +259,10 @@ const onSubmit = () => {
258259
};
259260
260261
const handleCreate = () => {
261-
const request = buildRequest(form);
262+
const request = buildRequest({
263+
...form,
264+
slug: form.name.toLowerCase().replace(/ /g, '-'),
265+
});
262266
Message.info(null, {
263267
title: 'Insights project is being created',
264268
});

Diff for: frontend/src/modules/admin/modules/insights-projects/models/insights-project-add-form.model.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export interface InsightsProjectAddFormModel {
55
logoUrl: string;
66
collectionsIds: string[];
77
organizationId: string | undefined;
8+
slug: string;
89
organization: {
910
id: string | undefined;
1011
displayName: string;
@@ -14,11 +15,7 @@ export interface InsightsProjectAddFormModel {
1415
github: string;
1516
twitter: string;
1617
linkedin: string;
17-
repositories: {
18-
url: string;
19-
enabled: boolean;
20-
platforms: string[];
21-
}[];
18+
repositories: string[];
2219
widgets: {
2320
[key: string]: boolean;
2421
};

Diff for: frontend/src/modules/admin/modules/insights-projects/models/insights-project.model.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { CollectionModel } from '../../collections/models/collection.model';
22

33
export interface InsightsProjectModel {
44
id: string;
5+
slug: string;
56
segmentId: string;
67
segment: {
78
id: string;
@@ -23,10 +24,6 @@ export interface InsightsProjectModel {
2324
linkedin: string;
2425
starred: boolean;
2526
enabled: boolean;
26-
repositories: {
27-
url: string;
28-
enabled: boolean;
29-
platforms: string[];
30-
}[];
27+
repositories: string[];
3128
widgets: string[];
3229
}

Diff for: services/libs/data-access-layer/src/collections/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ export async function createCollection(
105105
): Promise<ICollection> {
106106
return qx.selectOne(
107107
`
108-
INSERT INTO collections (name, description, "isLF")
109-
VALUES ($(name), $(description), $(isLF))
108+
INSERT INTO collections (name, description, "isLF", slug)
109+
VALUES ($(name), $(description), $(isLF), $(slug))
110110
RETURNING *
111111
`,
112112
collection,
@@ -137,6 +137,7 @@ export enum InsightsProjectField {
137137
TWITTER = 'twitter',
138138
WIDGETS = 'widgets',
139139
REPOSITORIES = 'repositories',
140+
SLUG = 'slug',
140141
}
141142

142143
export async function queryInsightsProjects<T extends InsightsProjectField>(

0 commit comments

Comments
 (0)