feat(admin): add taxonomy and authorization pages
This commit is contained in:
@@ -397,6 +397,21 @@ class ApiClient {
|
||||
return this.request<Types.UserListSchema[]>(`/api/auth/users${query.toString() ? `?${query.toString()}` : ''}`);
|
||||
}
|
||||
|
||||
async listAuthorizationRoles() {
|
||||
return this.request<Types.AuthorizationRoleSchema[]>('/api/auth/roles');
|
||||
}
|
||||
|
||||
async getUserAuthorization(userId: number) {
|
||||
return this.request<Types.UserAuthorizationSchema>(`/api/auth/users/${userId}/authorization`);
|
||||
}
|
||||
|
||||
async updateUserAuthorization(userId: number, data: Types.UserAuthorizationUpdateSchema) {
|
||||
return this.request<Types.UserAuthorizationSchema>(`/api/auth/users/${userId}/authorization`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
// ============= Blog Endpoints =============
|
||||
|
||||
async getPosts(params?: {
|
||||
@@ -648,6 +663,30 @@ class ApiClient {
|
||||
return this.request<Types.CategorySchema[]>('/api/blog/categories');
|
||||
}
|
||||
|
||||
async listAdminCategories() {
|
||||
return this.request<Types.AdminCategorySchema[]>('/api/blog/admin/categories');
|
||||
}
|
||||
|
||||
async createCategory(data: Types.CategoryWriteSchema) {
|
||||
return this.request<Types.AdminCategorySchema>('/api/blog/admin/categories', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
async updateCategory(categoryId: number, data: Types.CategoryWriteSchema) {
|
||||
return this.request<Types.AdminCategorySchema>(`/api/blog/admin/categories/${categoryId}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
async deleteCategory(categoryId: number) {
|
||||
return this.request<Types.MessageSchema>(`/api/blog/admin/categories/${categoryId}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
async getCategory(slug: string) {
|
||||
return this.request<Types.CategorySchema>(`/api/blog/categories/${slug}`);
|
||||
}
|
||||
@@ -667,6 +706,30 @@ class ApiClient {
|
||||
return this.request<Types.TagSchema[]>('/api/blog/tags');
|
||||
}
|
||||
|
||||
async listAdminTags() {
|
||||
return this.request<Types.AdminTagSchema[]>('/api/blog/admin/tags');
|
||||
}
|
||||
|
||||
async createTag(data: Types.TagWriteSchema) {
|
||||
return this.request<Types.AdminTagSchema>('/api/blog/admin/tags', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
async updateTag(tagId: number, data: Types.TagWriteSchema) {
|
||||
return this.request<Types.AdminTagSchema>(`/api/blog/admin/tags/${tagId}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
async deleteTag(tagId: number) {
|
||||
return this.request<Types.MessageSchema>(`/api/blog/admin/tags/${tagId}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
async getTag(slug: string) {
|
||||
return this.request<Types.TagSchema>(`/api/blog/tags/${slug}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user