fix(core): update
This commit is contained in:
@ -3,3 +3,4 @@ export * from './ora.classes.organization';
|
||||
export * from './ora.classes.project';
|
||||
export * from './ora.classes.list';
|
||||
export * from './ora.classes.task';
|
||||
export * from './ora.classes.milestone';
|
||||
|
47
ts/ora.classes.milestone.ts
Normal file
47
ts/ora.classes.milestone.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import * as plugins from './ora.plugins';
|
||||
import { OraProject } from './ora.classes.project';
|
||||
|
||||
export interface IOraMilestone {
|
||||
id: number;
|
||||
title: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
archived: boolean;
|
||||
complete: boolean;
|
||||
deadline: string;
|
||||
color: string;
|
||||
position: number;
|
||||
}
|
||||
|
||||
export class OraMilestone implements IOraMilestone {
|
||||
// ======
|
||||
// STATIC
|
||||
// ======
|
||||
public static async getAllMilestonesForProject(oraProjectArg: OraProject) {
|
||||
const response = await oraProjectArg.oraOrganizationRef.oraRef.request(`/projects/${oraProjectArg.id}/milestones`, 'GET');
|
||||
const milestones: OraMilestone[] = [];
|
||||
for (const dataObject of response.data) {
|
||||
milestones.push(new OraMilestone(oraProjectArg, dataObject));
|
||||
}
|
||||
return milestones;
|
||||
}
|
||||
|
||||
// ========
|
||||
// INSTANCE
|
||||
// ========
|
||||
public id: number;
|
||||
public title: string;
|
||||
public created_at: string;
|
||||
public updated_at: string;
|
||||
public archived: boolean;
|
||||
public complete: boolean;
|
||||
public deadline: string;
|
||||
public color: string;
|
||||
public position: number;
|
||||
|
||||
public oraProjectRef: OraProject;
|
||||
constructor(oraProjectRef: OraProject, creationObjectArg: IOraMilestone) {
|
||||
this.oraProjectRef = oraProjectRef;
|
||||
Object.assign(this, creationObjectArg);
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ import * as plugins from './ora.plugins';
|
||||
import { Ora } from './ora.classes.ora';
|
||||
import { OraOrganization } from './ora.classes.organization';
|
||||
import { OraList } from './ora.classes.list';
|
||||
import { OraMilestone } from './ora.classes.milestone';
|
||||
|
||||
export interface IOraProject {
|
||||
archived: boolean;
|
||||
@ -81,4 +82,8 @@ export class OraProject implements IOraProject {
|
||||
public async getLists(): Promise<OraList[]> {
|
||||
return OraList.getAllLists(this);
|
||||
}
|
||||
|
||||
public async getMileStones(): Promise<OraMilestone[]> {
|
||||
return OraMilestone.getAllMilestonesForProject(this);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import * as plugins from './ora.plugins';
|
||||
import { OraList } from './ora.classes.list';
|
||||
import { OraMilestone } from './ora.classes.milestone';
|
||||
|
||||
export interface IOraTask {
|
||||
milestone_id: number;
|
||||
@ -92,4 +93,8 @@ export class OraTask implements IOraTask {
|
||||
this.oraListRef = oraListRefArg;
|
||||
Object.assign(this, creationObjectArg);
|
||||
}
|
||||
|
||||
public async getMilestone (): Promise<OraMilestone> {
|
||||
return (await this.oraListRef.oraProjectObjectRef.getMileStones()).find(milestoneArg => milestoneArg.id === this.milestone_id);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user