Skip to content

Commit

Permalink
Add changesets for DAM scoping (PR #976) (#1397)
Browse files Browse the repository at this point in the history
Add changesets for DAM scoping (PR #976)

---------

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
Co-authored-by: Johannes Obermair <johannes.obermair@vivid-planet.com>
  • Loading branch information
3 people authored Nov 16, 2023
1 parent a93bb3f commit 9d3e855
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changeset/famous-ears-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/cms-api": major
---

Remove `File` entity export

Depending on your use case, you may either use the created file entity in the application code, or the `FileInterface` export instead.
19 changes: 19 additions & 0 deletions .changeset/slow-sloths-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"@comet/cms-api": major
---

Change `FilesService.upload` method signature

The method now accepts an options object as first argument, and a second `scope` argument.

**Before**

```ts
await filesService.upload(file, folderId);
```

**After**

```ts
await filesService.upload({ file, folderId }, scope);
```
7 changes: 7 additions & 0 deletions .changeset/strong-pans-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@comet/cms-api": major
---

Remove `Folder` entity export

Depending on your use case, you may either use the created folder entity in the application code, or the `FolderInterface` export instead.
28 changes: 28 additions & 0 deletions .changeset/ten-numbers-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
"@comet/cms-admin": major
"@comet/cms-api": major
---

Add scoping to the DAM

The DAM scoping can be enabled optionally. You can still use the DAM without scoping.

To enable DAM scoping, you must

In the API:

- Create a DAM folder entity using `createFolderEntity({ Scope: DamScope });`
- Create a DAM file entity using `createFileEntity({ Scope: DamScope, Folder: DamFolder });`
- Pass the `Scope` DTO and the `File` and `Folder` entities when intializing the `DamModule`

In the Admin:

- Set `scopeParts` in the `DamConfigProvider` (e.g. `<DamConfigProvider value={{ scopeParts: ["domain"] }}>`)
- Render the content scope indicator in the `DamPage`
```tsx
<DamPage renderContentScopeIndicator={(scope) => <ContentScopeIndicator scope={scope} />} />
```

You can access the current DAM scope in the Admin using the `useDamScope()` hook.

See Demo for an example on how to enable DAM scoping.

0 comments on commit 9d3e855

Please sign in to comment.