Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin: Add users panel #351

Merged
merged 12 commits into from
Apr 16, 2024
397 changes: 397 additions & 0 deletions admin/openapi/Instanssi.yaml

Large diffs are not rendered by default.

338 changes: 169 additions & 169 deletions admin/package-lock.json

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions admin/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ const primaryLinks: NavigationLinks = [
},
];
const secondaryLinks: NavigationLinks = [
{
title: t("App.nav.users"),
icon: "fas fa-users",
to: "users",
noEventId: true,
},
{
title: t("App.nav.logout"),
icon: "fas fa-right-from-bracket",
Expand Down
3 changes: 3 additions & 0 deletions admin/src/api/APIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { BlogEntriesService } from "./services/BlogEntriesService";
import { EventsService } from "./services/EventsService";
import { UserCompoEntriesService } from "./services/UserCompoEntriesService";
import { UserInfoService } from "./services/UserInfoService";
import { UsersService } from "./services/UsersService";

type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
export class APIClient {
Expand All @@ -21,6 +22,7 @@ export class APIClient {
public readonly events: EventsService;
public readonly userCompoEntries: UserCompoEntriesService;
public readonly userInfo: UserInfoService;
public readonly users: UsersService;
public readonly request: BaseHttpRequest;
constructor(
config?: Partial<OpenAPIConfig>,
Expand All @@ -42,5 +44,6 @@ export class APIClient {
this.events = new EventsService(this.request);
this.userCompoEntries = new UserCompoEntriesService(this.request);
this.userInfo = new UserInfoService(this.request);
this.users = new UsersService(this.request);
}
}
8 changes: 8 additions & 0 deletions admin/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,27 @@ export type { CompoEntry } from "./models/CompoEntry";
export type { CompoEntryRequest } from "./models/CompoEntryRequest";
export type { Event } from "./models/Event";
export type { EventRequest } from "./models/EventRequest";
export type { Group } from "./models/Group";
export type { GroupRequest } from "./models/GroupRequest";
export type { PaginatedBlogEntryList } from "./models/PaginatedBlogEntryList";
export type { PaginatedCompoEntryList } from "./models/PaginatedCompoEntryList";
export type { PaginatedEventList } from "./models/PaginatedEventList";
export type { PaginatedUserList } from "./models/PaginatedUserList";
export type { PatchedBlogEntryRequest } from "./models/PatchedBlogEntryRequest";
export type { PatchedCompoEntryRequest } from "./models/PatchedCompoEntryRequest";
export type { PatchedEventRequest } from "./models/PatchedEventRequest";
export type { PatchedUserRequest } from "./models/PatchedUserRequest";
export type { Permission } from "./models/Permission";
export type { PermissionRequest } from "./models/PermissionRequest";
export type { SocialAuthURL } from "./models/SocialAuthURL";
export type { User } from "./models/User";
export type { UserInfo } from "./models/UserInfo";
export type { UserLoginRequest } from "./models/UserLoginRequest";
export type { UserRequest } from "./models/UserRequest";

export { AuthService } from "./services/AuthService";
export { BlogEntriesService } from "./services/BlogEntriesService";
export { EventsService } from "./services/EventsService";
export { UserCompoEntriesService } from "./services/UserCompoEntriesService";
export { UserInfoService } from "./services/UserInfoService";
export { UsersService } from "./services/UsersService";
7 changes: 7 additions & 0 deletions admin/src/api/models/Group.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type Group = {
name: string;
};
7 changes: 7 additions & 0 deletions admin/src/api/models/GroupRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type GroupRequest = {
name: string;
};
15 changes: 15 additions & 0 deletions admin/src/api/models/PaginatedUserList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* generated using openapi-typescript-codegen -- do not edit */

/* istanbul ignore file */

/* tslint:disable */

/* eslint-disable */
import type { User } from "./User";

export type PaginatedUserList = {
count: number;
next?: string | null;
previous?: string | null;
results: Array<User>;
};
17 changes: 17 additions & 0 deletions admin/src/api/models/PatchedUserRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type PatchedUserRequest = {
/**
* Vaaditaan. Enintään 150 merkkiä. Vain kirjaimet, numerot ja @/./+/-/_ ovat sallittuja.
*/
username?: string;
first_name?: string;
last_name?: string;
email?: string;
/**
* Määrää, voiko käyttäjä kirjautua sisään. Tällä voi estää käyttäjätilin käytön poistamatta sitä.
*/
is_active?: boolean;
};
8 changes: 8 additions & 0 deletions admin/src/api/models/PermissionRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type PermissionRequest = {
name: string;
codename: string;
};
31 changes: 31 additions & 0 deletions admin/src/api/models/User.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* generated using openapi-typescript-codegen -- do not edit */

/* istanbul ignore file */

/* tslint:disable */

/* eslint-disable */
import type { Group } from "./Group";
import type { Permission } from "./Permission";

export type User = {
readonly id: number;
/**
* Vaaditaan. Enintään 150 merkkiä. Vain kirjaimet, numerot ja @/./+/-/_ ovat sallittuja.
*/
username: string;
first_name?: string;
last_name?: string;
email?: string;
readonly user_permissions: Array<Permission>;
/**
* Antaa käyttäjälle kaikki oikeudet ilman, että niitä täytyy erikseen luetella.
*/
readonly is_superuser: boolean;
readonly date_joined: string;
readonly groups: Array<Group>;
/**
* Määrää, voiko käyttäjä kirjautua sisään. Tällä voi estää käyttäjätilin käytön poistamatta sitä.
*/
is_active?: boolean;
};
7 changes: 6 additions & 1 deletion admin/src/api/models/UserInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ import type { Permission } from "./Permission";

export type UserInfo = {
readonly id: number;
/**
* Vaaditaan. Enintään 150 merkkiä. Vain kirjaimet, numerot ja @/./+/-/_ ovat sallittuja.
*/
username: string;
first_name?: string;
last_name?: string;
email?: string;
readonly user_permissions: Array<Permission>;
/**
* Antaa käyttäjälle kaikki oikeudet ilman, että niitä täytyy erikseen luetella.
*/
is_superuser?: boolean;
readonly is_superuser: boolean;
readonly date_joined: string;
};
17 changes: 17 additions & 0 deletions admin/src/api/models/UserRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type UserRequest = {
/**
* Vaaditaan. Enintään 150 merkkiä. Vain kirjaimet, numerot ja @/./+/-/_ ovat sallittuja.
*/
username: string;
first_name?: string;
last_name?: string;
email?: string;
/**
* Määrää, voiko käyttäjä kirjautua sisään. Tällä voi estää käyttäjätilin käytön poistamatta sitä.
*/
is_active?: boolean;
};
126 changes: 126 additions & 0 deletions admin/src/api/services/UsersService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/* generated using openapi-typescript-codegen -- do not edit */

/* istanbul ignore file */

/* tslint:disable */

/* eslint-disable */
import type { BaseHttpRequest } from "../core/BaseHttpRequest";
import type { CancelablePromise } from "../core/CancelablePromise";
import type { PaginatedUserList } from "../models/PaginatedUserList";
import type { PatchedUserRequest } from "../models/PatchedUserRequest";
import type { User } from "../models/User";
import type { UserRequest } from "../models/UserRequest";

export class UsersService {
constructor(public readonly httpRequest: BaseHttpRequest) {}
/**
* @param email
* @param limit Number of results to return per page.
* @param offset The initial index from which to return the results.
* @param ordering Which field to use when ordering the results.
* @param search A search term.
* @param username
* @returns PaginatedUserList
* @throws ApiError
*/
public usersList(
email?: string,
limit?: number,
offset?: number,
ordering?: string,
search?: string,
username?: string
): CancelablePromise<PaginatedUserList> {
return this.httpRequest.request({
method: "GET",
url: "/api/v2/users/",
query: {
email: email,
limit: limit,
offset: offset,
ordering: ordering,
search: search,
username: username,
},
});
}
/**
* @param requestBody
* @returns User
* @throws ApiError
*/
public usersCreate(requestBody: UserRequest): CancelablePromise<User> {
return this.httpRequest.request({
method: "POST",
url: "/api/v2/users/",
body: requestBody,
mediaType: "application/json",
});
}
/**
* @param id A unique integer value identifying this käyttäjä.
* @returns User
* @throws ApiError
*/
public usersRetrieve(id: number): CancelablePromise<User> {
return this.httpRequest.request({
method: "GET",
url: "/api/v2/users/{id}/",
path: {
id: id,
},
});
}
/**
* @param id A unique integer value identifying this käyttäjä.
* @param requestBody
* @returns User
* @throws ApiError
*/
public usersUpdate(id: number, requestBody: UserRequest): CancelablePromise<User> {
return this.httpRequest.request({
method: "PUT",
url: "/api/v2/users/{id}/",
path: {
id: id,
},
body: requestBody,
mediaType: "application/json",
});
}
/**
* @param id A unique integer value identifying this käyttäjä.
* @param requestBody
* @returns User
* @throws ApiError
*/
public usersPartialUpdate(
id: number,
requestBody?: PatchedUserRequest
): CancelablePromise<User> {
return this.httpRequest.request({
method: "PATCH",
url: "/api/v2/users/{id}/",
path: {
id: id,
},
body: requestBody,
mediaType: "application/json",
});
}
/**
* @param id A unique integer value identifying this käyttäjä.
* @returns void
* @throws ApiError
*/
public usersDestroy(id: number): CancelablePromise<void> {
return this.httpRequest.request({
method: "DELETE",
url: "/api/v2/users/{id}/",
path: {
id: id,
},
});
}
}
Loading
Loading