Skip to content

Commit

Permalink
feat: Add support for deleting TPW items
Browse files Browse the repository at this point in the history
  • Loading branch information
LautaroPetaccio committed Nov 16, 2021
1 parent 6925c3f commit 3f46ea8
Show file tree
Hide file tree
Showing 7 changed files with 490 additions and 91 deletions.
2 changes: 1 addition & 1 deletion src/Collection/Collection.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export class CollectionService {
}))
}

private async getDBCollection(
public async getDBCollection(
collectionId: string
): Promise<CollectionAttributes> {
const collection = await Collection.findOne(collectionId)
Expand Down
45 changes: 45 additions & 0 deletions src/Item/Item.exceptions.ts
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 NonExistentItemException extends Error {
constructor(public id: string) {
super("The item doesn't exist.")
}
}

export class ThirdPartyItemAlreadyPublishedException 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 DCLItemAlreadyPublishedException 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 CollectionForItemLockedException extends Error {
constructor(public id: string, action: ItemAction) {
super(`The collection for the item is locked. The item can't be ${action}.`)
}
}

export class InconsistentItemException extends Error {
constructor(public id: string, message: string) {
super(message)
}
}
Loading

0 comments on commit 3f46ea8

Please sign in to comment.