Skip to content

Commit

Permalink
feat: Add Card class.
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-coster committed Jul 3, 2021
1 parent 82e3e7b commit 5133cb4
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions src/lib/entities/BravoCard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import type { DataFavroCard } from '$/types/FavroCardTypes.js';
import { BravoEntity } from '$lib/BravoEntity.js';

export class BravoCard extends BravoEntity<DataFavroCard> {
get name() {
return this._data.name;
}

/** The card's ID within a widget */
get cardId() {
return this._data.cardId;
}

/** The card's global ID, the same in all widgets in which this card appears */
get cardCommonId() {
return this._data.cardCommonId;
}

get columnId() {
return this._data.columnId;
}

get parentCardId() {
return this._data.parentCardId;
}

get widgetCommonId() {
return this._data.widgetCommonId;
}

get tags() {
return [...this._data.tags];
}

get detailedDescription() {
return this._data.detailedDescription;
}

get attachments() {
return this._data.attachments;
}

/**
* Delete this card from its Widget (the one it
* was fetched from in search results). Optionally
* delete it everywhere else, too!
*/
async delete(everywhere = false) {
return this._client.deleteCard(this.cardId, everywhere);
}

equals(org: BravoCard) {
return (
this.hasSameConstructor(org) && this.cardCommonId === org.cardCommonId
);
}
}

0 comments on commit 5133cb4

Please sign in to comment.