agregar paginacion a /userstorys/ + redisenar dashboard de proyecto con epicas y HUs

This commit is contained in:
2026-05-27 13:48:07 -05:00
parent 0f26506d54
commit 5ef2b2c8e5
3 changed files with 157 additions and 106 deletions
+17 -3
View File
@@ -99,9 +99,23 @@ class KappaAPI {
return this.request<PaginatedResponse<KappaEmployee>>('GET', `/employees/?page=${page}`)
}
async getUserStories(initiativeId?: number): Promise<KappaUserStory[]> {
const path = initiativeId ? `/userstorys/?initiative=${initiativeId}` : '/userstorys/'
return this.request<KappaUserStory[]>('GET', path)
async getUserStories(initiativeId?: number, page = 1, pageSize = 100): Promise<PaginatedResponse<KappaUserStory>> {
const params = new URLSearchParams()
if (initiativeId) params.set('initiative', String(initiativeId))
params.set('page', String(page))
params.set('page_size', String(pageSize))
return this.request<PaginatedResponse<KappaUserStory>>('GET', `/userstorys/?${params.toString()}`)
}
async getAllUserStories(initiativeId: number): Promise<KappaUserStory[]> {
const first = await this.getUserStories(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.getUserStories(initiativeId, p, 100)
all.push(...page.results)
}
return all
}
async getEpicDevelopment(initiativeId: number, page = 1, pageSize = 50): Promise<PaginatedResponse<KappaEpicDevelopment>> {