agregar endpoint /epicdevelopment/ + store de epicas y HUs por proyecto
This commit is contained in:
@@ -3,6 +3,7 @@ import type {
|
||||
KappaLoginResponse,
|
||||
KappaInitiative,
|
||||
KappaUserStory,
|
||||
KappaEpicDevelopment,
|
||||
KappaLogbookMaster,
|
||||
KappaLogbookEntry,
|
||||
KappaPlanningMaster,
|
||||
@@ -103,6 +104,21 @@ class KappaAPI {
|
||||
return this.request<KappaUserStory[]>('GET', path)
|
||||
}
|
||||
|
||||
async getEpicDevelopment(initiativeId: number, page = 1, pageSize = 50): Promise<PaginatedResponse<KappaEpicDevelopment>> {
|
||||
return this.request<PaginatedResponse<KappaEpicDevelopment>>('GET', `/epicdevelopment/?initiative=${initiativeId}&page=${page}&page_size=${pageSize}`)
|
||||
}
|
||||
|
||||
async getAllEpicDevelopment(initiativeId: number): Promise<KappaEpicDevelopment[]> {
|
||||
const first = await this.getEpicDevelopment(initiativeId, 1, 100)
|
||||
const all = [...first.results]
|
||||
const totalPages = Math.ceil(first.count / 100)
|
||||
for (let p = 2; p <= totalPages; p++) {
|
||||
const page = await this.getEpicDevelopment(initiativeId, p, 100)
|
||||
all.push(...page.results)
|
||||
}
|
||||
return all
|
||||
}
|
||||
|
||||
async getLogbooks(initiativeId?: number): Promise<KappaLogbookEntry[]> {
|
||||
const path = initiativeId ? `/logbooks/?initiative=${initiativeId}` : '/logbooks/'
|
||||
return this.request<KappaLogbookEntry[]>('GET', path)
|
||||
|
||||
@@ -10,6 +10,17 @@ export interface ProjectRecord {
|
||||
end_date: string | null
|
||||
}
|
||||
|
||||
export interface WorkItemRecord {
|
||||
id: number
|
||||
project_id: number
|
||||
code: string | null
|
||||
title: string
|
||||
description: string | null
|
||||
type: string
|
||||
status: string
|
||||
priority: string
|
||||
}
|
||||
|
||||
export interface AlphaUserRecord {
|
||||
id: number
|
||||
email: string
|
||||
@@ -91,6 +102,17 @@ export const tauriDb = {
|
||||
return invoke('delete_project', { id })
|
||||
},
|
||||
|
||||
// Work Items
|
||||
getWorkItems(projectId: number): Promise<WorkItemRecord[]> {
|
||||
return invoke('get_work_items', { projectId })
|
||||
},
|
||||
saveWorkItem(item: WorkItemRecord): Promise<number> {
|
||||
return invoke('save_work_item', { item })
|
||||
},
|
||||
deleteWorkItem(id: number): Promise<void> {
|
||||
return invoke('delete_work_item', { id })
|
||||
},
|
||||
|
||||
// Users
|
||||
getUsers(): Promise<AlphaUserRecord[]> {
|
||||
return invoke('get_users')
|
||||
|
||||
Reference in New Issue
Block a user