Skip to content

Commit

Permalink
Merge pull request #120 from polarsquad/add-projectassignmentskill-fu…
Browse files Browse the repository at this point in the history
…nctionality

Add functionality to interact with project assignment skills
  • Loading branch information
joonvena authored Nov 13, 2023
2 parents cc056c4 + 8cb56b4 commit d013e7b
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polarsquad/cinode-api",
"version": "0.12.4",
"version": "0.12.5",
"description": "Cinode API for the Cinode platform",
"homepage": "https://github.com/polarsquad/cinode-api#readme",
"bugs": {
Expand Down
57 changes: 57 additions & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
Project,
ProjectAssignment,
ProjectAssignmentEdit,
ProjectAssignmentMemberSkill,
ProjectAssignmentWithStatus,
ProjectBase,
ProjectPipeline,
Expand Down Expand Up @@ -383,4 +384,60 @@ export class Api {
.get(`v0.1/companies/${this.company.id}/teams/${teamId}`)
.json<TeamBase>();
}

addProjectAssignmentSkill(
projectId: number,
roleId: number,
skill: string,
level: number,
isMandatory = false
) {
return this.client
.post(
`v0.1/companies/${this.company.id}/projects/${projectId}/roles/${roleId}/skills`,
{
headers: {
'Content-type': 'application/json-patch+json',
},
json: {
name: skill,
level,
isMandatory,
},
}
)
.json<ProjectAssignmentMemberSkill>();
}

updateProjectAssignmentSkill(
projectId: number,
roleId: number,
skillId: number,
level: number,
isMandatory = false
) {
return this.client
.put(
`v0.1/companies/${this.company.id}/projects/${projectId}/roles/${roleId}/skills/${skillId}`,
{
json: {
level,
isMandatory,
},
}
)
.json<ProjectAssignmentMemberSkill>();
}

removeProjectAssignmentSkill(
projectId: number,
roleId: number,
skillId: number
) {
return this.client
.delete(
`v0.1/companies/${this.company.id}/projects/${projectId}/roles/${roleId}/skills/${skillId}`
)
.json<void>();
}
}
44 changes: 44 additions & 0 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,4 +438,48 @@ export class CinodeService {
async getTeam(teamId: number) {
return this.api.getTeam(teamId);
}

async addProjectAssignmentSkill(
projectId: number,
roleId: number,
skill: string,
level: number,
isMandatory: boolean
) {
return await this.api.addProjectAssignmentSkill(
projectId,
roleId,
skill,
level,
isMandatory
);
}

async updateProjectAssignmentSkill(
projectId: number,
roleId: number,
skillId: number,
level: number,
isMandatory: boolean
) {
return await this.api.updateProjectAssignmentSkill(
projectId,
roleId,
skillId,
level,
isMandatory
);
}

async removeProjectAssignmentSkill(
projectId: number,
roleId: number,
skillId: number
) {
return await this.api.removeProjectAssignmentSkill(
projectId,
roleId,
skillId
);
}
}
7 changes: 7 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,13 @@ export interface ProjectAssignmentMember extends CompanyUserBase {
projectAssignmentMemberState?: ProjectAssignmentMemberState | null;
}

export interface ProjectAssignmentMemberSkill {
name?: string;
keywordSynonymId?: number | null;
level?: number;
isMandatory?: boolean;
}

export interface ProjectAssignmentSkillBase {
companyId?: number;

Expand Down

0 comments on commit d013e7b

Please sign in to comment.