Skip to content

Commit

Permalink
CTC-2272 Adjust migration samples
Browse files Browse the repository at this point in the history
  • Loading branch information
jancerman committed Jul 11, 2024
1 parent 3a58da1 commit ebad2b5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
const migrationItems: MigrationItem[] = [];
// 2. Map exported files to MigrationAssets
const migrationAssets: MigrationAsset[] = [];

// 3. Import the exported and mapped data into Kontent.ai
await importAsync({
data: {
Expand All @@ -17,4 +16,4 @@ await importAsync({
},
environmentId: "KONTENT_AI_ENVIRONMENT_ID",
apiKey: "MANAGEMENT_API_KEY",
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const coverAsset: MigrationAsset = {
filename: "warrior_teaser.jpg",
// Name the asset
title: "Warrior cover",
// Asign the asset to a collection
// (Optional) Asign the asset to a collection
collection: {
codename: "default",
},
// Specify localized asset descriptions
// (Optional) Specify localized asset descriptions
descriptions: [
{
language: {
Expand All @@ -25,4 +25,4 @@ const coverAsset: MigrationAsset = {
],
};

const migrationAssets: MigrationAsset[] = [coverAsset];
const migrationAssets: MigrationAsset[] = [coverAsset];
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ const movie: MigrationItem<MovieType> = {
type: { codename: "movie" },
workflow: { codename: "default" },
},
// Tip: You can migrate up to 2 versions - 1 published and one in draft state. This is optional and typically
// you only need to migrate a single version of your content
// Migrate up to 2 versions - latest and published. This is optional. Typically, you'd only migrate a single version of your content.
versions: [
{
workflow_step: {
Expand All @@ -48,23 +47,23 @@ const movie: MigrationItem<MovieType> = {
],
}),
poster: elementsBuilder.assetElement({
// Reference assets by their codenames
value: [
// Reference assets by their codenames
{
codename: "warrior_teaser",
},
],
}),
plot: elementsBuilder.richTextElement({
// Check allowed HTML elements in rich text value at https://kontent.ai/learn/rich-text-in-mapi
value: {
// Check supported HTML elements at https://kontent.ai/learn/rich-text-in-mapi
value: `<h1>Warrior</h1><p>...</p>`,
value: `<h1>Warrior</h1><p>...</p>`,
components: [],
},
}),
releasecategory: elementsBuilder.taxonomyElement({
// Reference taxonomy terms by their codenames
value: [
// Reference taxonomy terms by their codenames
{
codename: "global_release",
},
Expand All @@ -74,14 +73,15 @@ const movie: MigrationItem<MovieType> = {
value: "2011-09-09T00:00:00Z",
}),
seoname: elementsBuilder.urlSlugElement({
// The value is empty because it's autogenerated based on a dependent text element
value: {
mode: "autogenerated",
value: "", // Empty string because 'value' is autogenerated based on the dependent text element
value: "",
},
}),
stars: elementsBuilder.linkedItemsElement({
// Reference content items by their codenames
value: [
// Reference content items by their codenames
{
codename: "tom_hardy",
},
Expand All @@ -92,4 +92,4 @@ const movie: MigrationItem<MovieType> = {
],
};

const migrationItems: MigrationItem[] = [movie];
const migrationItems: MigrationItem[] = [movie];
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ const migrationItem: MigrationItem = {
},
},
],
};
};

0 comments on commit ebad2b5

Please sign in to comment.