-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for deleting TPW items (#355)
* feat: Add support for deleting TPW items * chore: Add functions to check if a db collection or a db items are TP collections or TP items * chore: Renamed item exceptions to errors. Re-used the collection and item utils. * fix: Code & tests
- Loading branch information
1 parent
6925c3f
commit d6d69cc
Showing
8 changed files
with
455 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export enum ItemAction { | ||
DELETE = 'deleted', | ||
} | ||
|
||
export enum ItemType { | ||
DCL, | ||
THIRD_PARTY, | ||
} | ||
|
||
export class NonExistentItemError extends Error { | ||
constructor(public id: string) { | ||
super("The item doesn't exist.") | ||
} | ||
} | ||
|
||
export class ThirdPartyItemAlreadyPublishedError extends Error { | ||
constructor(public id: string, public urn: string, action: ItemAction) { | ||
super(`The third party item is already published. It can't be ${action}.`) | ||
} | ||
} | ||
|
||
export class DCLItemAlreadyPublishedError extends Error { | ||
constructor( | ||
public id: string, | ||
public blockchainItemId: string, | ||
public contractAddress: string, | ||
action: ItemAction | ||
) { | ||
super( | ||
`The collection that contains this item has been already published. The item can't be ${action}.` | ||
) | ||
} | ||
} | ||
|
||
export class CollectionForItemLockedError extends Error { | ||
constructor(public id: string, action: ItemAction) { | ||
super(`The collection for the item is locked. The item can't be ${action}.`) | ||
} | ||
} | ||
|
||
export class InconsistentItemError extends Error { | ||
constructor(public id: string, message: string) { | ||
super(message) | ||
} | ||
} |
Oops, something went wrong.