agregar paginacion a /userstorys/ + redisenar dashboard de proyecto con epicas y HUs
This commit is contained in:
@@ -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>> {
|
||||
|
||||
Reference in New Issue
Block a user