Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions apps/nestjs-backend/src/features/base/base.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,12 +616,11 @@ export class BaseService {
where: { baseId },
select: { id: true },
});
const { title, description, cover, nodes, includeData } = publishBaseRo;

const snapshot = await this.createSnapshot(baseId, nodes, includeData);
// if already published, update template
if (template) {
const { title, description, cover, nodes, includeData } = publishBaseRo;
const snapshot = await this.createSnapshot(baseId, nodes, includeData);

await prisma.template.update({
where: { id: template.id },
data: {
Expand All @@ -642,14 +641,18 @@ export class BaseService {
},
},
});
return;
return {
baseId: snapshot.baseId,
};
}

// if the base is not published, create a template
const { nodes, includeData } = publishBaseRo;
const snapshot = await this.createSnapshot(baseId, nodes, includeData);
// publish snapshot
await this.createTemplateBySnapshot(baseId, snapshot, publishBaseRo);

return {
baseId: snapshot.baseId,
};
}

private async createSnapshot(baseId: string, nodes?: string[], includeData?: boolean) {
Expand Down
4 changes: 4 additions & 0 deletions apps/nestjs-backend/src/types/i18n.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2813,6 +2813,10 @@ export type I18nTranslations = {
"publishValidation": string;
"atLeastOneNode": string;
};
"urlCopied": string;
"urlCopiedForDiscord": string;
"publishSuccessDescription": string;
"shareWith": string;
};
};
"system": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,15 +448,13 @@ export const NodeTreeSelect = (props: INodeSelectProps) => {
paddingLeft: `${item.getItemMeta().level * INDENTATION_WIDTH + 8}px`,
}}
>
{isFolder ? (
{isFolder && (
<ChevronDown
className={cn(
'size-4 shrink-0 transition-transform',
!isExpanded && '-rotate-90'
)}
/>
) : (
<div className="size-4 shrink-0" />
)}

{renderNodeIcon(item)}
Expand Down
Loading