Skip to content

Commit

Permalink
feat: Reorganize Column typings into the FavroApi namespace. BREAKING
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-coster committed Aug 29, 2021
1 parent ff78d1a commit eaa0a43
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 25 deletions.
3 changes: 1 addition & 2 deletions src/lib/BravoClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { BravoOrganization } from '$entities/BravoOrganization';
import { BravoWidget } from '$entities/BravoWidget.js';
import type { FavroApi } from '$favro';
import { BravoColumn } from './entities/BravoColumn.js';
import type { DataFavroColumn } from '$/types/FavroColumnTypes.js';
import type { ArrayMatchFunction, RequiredBy } from '$/types/Utility.js';
import type {
DataFavroCard,
Expand Down Expand Up @@ -452,7 +451,7 @@ export class BravoClient extends FavroClient {
`columns`,
{ method: 'get', query: { widgetCommonId } },
BravoColumn,
)) as BravoResponseEntities<DataFavroColumn, BravoColumn>;
)) as BravoResponseEntities<FavroApi.Column.Data, BravoColumn>;
const columns = await res.getAllEntities();
this.cache.setColumns(widgetCommonId, columns);
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/entities/BravoColumn.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { BravoEntity } from '$lib/BravoEntity.js';
import type { DataFavroColumn } from '$/types/FavroColumnTypes.js';
import type { FavroApi } from '$favro';

/**
* A Favro Column is one of the available values for the default
* "Status" field on a board (the same one used for KanBan view).
*/
export class BravoColumn extends BravoEntity<DataFavroColumn> {
export class BravoColumn extends BravoEntity<FavroApi.Column.Data> {
/** The unique identifier for this column on its parent Widget.*/
get columnId() {
return this._data.columnId;
Expand Down
28 changes: 28 additions & 0 deletions src/types/FavroApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,32 @@ export namespace FavroApi {
Pick<Data, 'name' | 'type' | 'color' | 'ownerRole' | 'editRole'>
>;
}

/**
* Favro API Data models for Columns
*/
export namespace Column {
/**
* The data model for Columns returned from the Favro API.
* {@link https://favro.com/developer/#column-object}
*/
export interface Data {
/** The id of the column. */
columnId: string;
/** The id of the organization that this column exists in. */
organizationId: string;
/** The common id of the widget that this column exists on. */
widgetCommonId: string;
/** The name of the column. */
name: string;
/** The position of the column on the widget. */
position: number;
/** Total number of cards on the column. */
cardCount: number;
/** Summary time spent of cards on the column in milisecond. */
timeSum: number;
/** Summary estimation of cards on the column. */
estimationSum: number;
}
}
}
21 changes: 0 additions & 21 deletions src/types/FavroColumnTypes.ts

This file was deleted.

0 comments on commit eaa0a43

Please sign in to comment.