feat: group statistics endpoint (#123)

* group statistics endpoint

* remove item store

* return possible errors

* add statistics tests
This commit is contained in:
Hayden 2022-11-01 13:58:05 -08:00 committed by GitHub
parent a886fa86ca
commit 7e0f1fac23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 201 additions and 74 deletions

View file

@ -1,5 +1,5 @@
import { BaseAPI, route } from "../base";
import { Group, GroupInvitation, GroupInvitationCreate, GroupUpdate } from "../types/data-contracts";
import { Group, GroupInvitation, GroupInvitationCreate, GroupStatistics, GroupUpdate } from "../types/data-contracts";
export class GroupApi extends BaseAPI {
createInvitation(data: GroupInvitationCreate) {
@ -21,4 +21,10 @@ export class GroupApi extends BaseAPI {
url: route("/groups"),
});
}
statistics() {
return this.http.get<GroupStatistics>({
url: route("/groups/statistics"),
});
}
}

View file

@ -24,6 +24,13 @@ export interface Group {
updatedAt: Date;
}
export interface GroupStatistics {
totalItems: number;
totalLabels: number;
totalLocations: number;
totalUsers: number;
}
export interface GroupUpdate {
currency: string;
name: string;