feat: add sorting for tables

This commit is contained in:
Elias Schneider
2025-01-11 20:14:12 +01:00
parent 61d18a9d1b
commit fd69830c26
27 changed files with 294 additions and 138 deletions

View File

@@ -1,11 +1,11 @@
import type { AuditLog } from '$lib/types/audit-log.type';
import type { Paginated, PaginationRequest } from '$lib/types/pagination.type';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import APIService from './api-service';
class AuditLogService extends APIService {
async list(pagination?: PaginationRequest) {
async list(options?: SearchPaginationSortRequest) {
const res = await this.api.get('/audit-logs', {
params: pagination
params: options
});
return res.data as Paginated<AuditLog>;
}

View File

@@ -1,9 +1,16 @@
import type { AuthorizeResponse, OidcClient, OidcClientCreate } from '$lib/types/oidc.type';
import type { Paginated, PaginationRequest } from '$lib/types/pagination.type';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import APIService from './api-service';
class OidcService extends APIService {
async authorize(clientId: string, scope: string, callbackURL: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string) {
async authorize(
clientId: string,
scope: string,
callbackURL: string,
nonce?: string,
codeChallenge?: string,
codeChallengeMethod?: string
) {
const res = await this.api.post('/oidc/authorize', {
scope,
nonce,
@@ -16,7 +23,14 @@ class OidcService extends APIService {
return res.data as AuthorizeResponse;
}
async authorizeNewClient(clientId: string, scope: string, callbackURL: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string) {
async authorizeNewClient(
clientId: string,
scope: string,
callbackURL: string,
nonce?: string,
codeChallenge?: string,
codeChallengeMethod?: string
) {
const res = await this.api.post('/oidc/authorize/new-client', {
scope,
nonce,
@@ -29,12 +43,9 @@ class OidcService extends APIService {
return res.data as AuthorizeResponse;
}
async listClients(search?: string, pagination?: PaginationRequest) {
async listClients(options?: SearchPaginationSortRequest) {
const res = await this.api.get('/oidc/clients', {
params: {
search,
...pagination
}
params: options
});
return res.data as Paginated<OidcClient>;
}

View File

@@ -1,4 +1,4 @@
import type { Paginated, PaginationRequest } from '$lib/types/pagination.type';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type {
UserGroupCreate,
UserGroupWithUserCount,
@@ -7,12 +7,9 @@ import type {
import APIService from './api-service';
export default class UserGroupService extends APIService {
async list(search?: string, pagination?: PaginationRequest) {
async list(options?: SearchPaginationSortRequest) {
const res = await this.api.get('/user-groups', {
params: {
search,
...pagination
}
params: options
});
return res.data as Paginated<UserGroupWithUserCount>;
}

View File

@@ -1,14 +1,11 @@
import type { Paginated, PaginationRequest } from '$lib/types/pagination.type';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type { User, UserCreate } from '$lib/types/user.type';
import APIService from './api-service';
export default class UserService extends APIService {
async list(search?: string, pagination?: PaginationRequest) {
async list(options?: SearchPaginationSortRequest) {
const res = await this.api.get('/users', {
params: {
search,
...pagination
}
params: options
});
return res.data as Paginated<User>;
}