Skip to content

Commit

Permalink
add skeleton for transforming snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanKiral committed Mar 14, 2024
1 parent b87366e commit 2bdd88e
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions src/modules/sync/modelTransfomers/contentTypeSnippets.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
import { omit } from "../../../utils/object.js";
import { EnvironmentModel } from "../generateSyncModel.js";
import { ContentTypeSnippetsSyncModel } from "../types/fileContentModel.js";

export const transformContentTypeSnippetsModel = (
environmentModel: EnvironmentModel,
environmentModel: EnvironmentModel
) => {
// TODO
environmentModel as never;
environmentModel.contentTypeSnippets.map(snippet => {
const syncSnippetElements: ContentTypeSnippetsSyncModel["elements"] = snippet.elements
.map(element => {
switch (element.type) {
case "guidelines":
return { ...element, codename: element.codename as string };
case "modular_content":
return { ...element, codename: element.codename as string };
case "taxonomy":
return { ...element, codename: element.codename as string };
case "multiple_choice":
return { ...element, codename: element.codename as string };
case "custom":
return { ...element, codename: element.codename as string };
case "asset":
return { ...element, codename: element.codename as string };
case "rich_text":
return { ...element, codename: element.codename as string };
default:
return { ...omit(element, ["id"]), codename: element.codename as string };
}
});

return { ...omit(snippet, ["id", "last_modified"]), elements: syncSnippetElements };
});

return [] as ContentTypeSnippetsSyncModel[];
};

0 comments on commit 2bdd88e

Please sign in to comment.