Kavita/UI/Web/src/app/_services/member.service.ts
Joe Milazzo 1c1e48d28c
Reading History (#1699)
* Added new stat graph for pages read over time for all users.

* Switched to reading events rather than pages read to get a better scale

* Changed query to use Created date as LastModified wont work since I just did a migration on all rows.

* Small cleanup on graph

* Read by day completed and ready for user stats page.

* Changed the initial stat report to be in 1 day, to avoid people trying and ditching the software from muddying up the stats.

* Cleaned up stats page such that stats around series show their image and tweaked some layout and wordings

* Fixed recently read order

* Put read history on user profile

* Final cleanup, Robbie needs to do a CSS pass before release.
2022-12-15 15:28:01 -08:00

55 lines
1.6 KiB
TypeScript

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import { Member } from '../_models/auth/member';
@Injectable({
providedIn: 'root'
})
export class MemberService {
baseUrl = environment.apiUrl;
constructor(private httpClient: HttpClient) { }
getMembers() {
return this.httpClient.get<Member[]>(this.baseUrl + 'users');
}
getMemberNames() {
return this.httpClient.get<string[]>(this.baseUrl + 'users/names');
}
adminExists() {
return this.httpClient.get<boolean>(this.baseUrl + 'admin/exists');
}
deleteMember(username: string) {
return this.httpClient.delete(this.baseUrl + 'users/delete-user?username=' + encodeURIComponent(username));
}
hasLibraryAccess(libraryId: number) {
return this.httpClient.get<boolean>(this.baseUrl + 'users/has-library-access?libraryId=' + libraryId);
}
hasReadingProgress(librayId: number) {
return this.httpClient.get<boolean>(this.baseUrl + 'users/has-reading-progress?libraryId=' + librayId);
}
getPendingInvites() {
return this.httpClient.get<Array<Member>>(this.baseUrl + 'users/pending');
}
addSeriesToWantToRead(seriesIds: Array<number>) {
return this.httpClient.post<Array<Member>>(this.baseUrl + 'want-to-read/add-series', {seriesIds});
}
removeSeriesToWantToRead(seriesIds: Array<number>) {
return this.httpClient.post<Array<Member>>(this.baseUrl + 'want-to-read/remove-series', {seriesIds});
}
getMember() {
return this.httpClient.get<Member>(this.baseUrl + 'users/myself');
}
}