Add paginated user retrieval functionality in AdminController and related services. Implemented UsersFilter for filtering user queries and added LastConnectionDate property to User model. Updated database schema and frontend API to support new user management features.
This commit is contained in:
@@ -529,6 +529,63 @@ export class AdminClient extends AuthorizedApiBase {
|
||||
}
|
||||
return Promise.resolve<FileResponse>(null as any);
|
||||
}
|
||||
|
||||
admin_GetUsersPaginated(page: number | undefined, pageSize: number | undefined, sortBy: UserSortableColumn | undefined, sortOrder: string | null | undefined, userNameContains: string | null | undefined, ownerAddressContains: string | null | undefined, agentNameContains: string | null | undefined, telegramChannelContains: string | null | undefined): Promise<PaginatedUsersResponse> {
|
||||
let url_ = this.baseUrl + "/Admin/Users/Paginated?";
|
||||
if (page === null)
|
||||
throw new Error("The parameter 'page' cannot be null.");
|
||||
else if (page !== undefined)
|
||||
url_ += "page=" + encodeURIComponent("" + page) + "&";
|
||||
if (pageSize === null)
|
||||
throw new Error("The parameter 'pageSize' cannot be null.");
|
||||
else if (pageSize !== undefined)
|
||||
url_ += "pageSize=" + encodeURIComponent("" + pageSize) + "&";
|
||||
if (sortBy === null)
|
||||
throw new Error("The parameter 'sortBy' cannot be null.");
|
||||
else if (sortBy !== undefined)
|
||||
url_ += "sortBy=" + encodeURIComponent("" + sortBy) + "&";
|
||||
if (sortOrder !== undefined && sortOrder !== null)
|
||||
url_ += "sortOrder=" + encodeURIComponent("" + sortOrder) + "&";
|
||||
if (userNameContains !== undefined && userNameContains !== null)
|
||||
url_ += "userNameContains=" + encodeURIComponent("" + userNameContains) + "&";
|
||||
if (ownerAddressContains !== undefined && ownerAddressContains !== null)
|
||||
url_ += "ownerAddressContains=" + encodeURIComponent("" + ownerAddressContains) + "&";
|
||||
if (agentNameContains !== undefined && agentNameContains !== null)
|
||||
url_ += "agentNameContains=" + encodeURIComponent("" + agentNameContains) + "&";
|
||||
if (telegramChannelContains !== undefined && telegramChannelContains !== null)
|
||||
url_ += "telegramChannelContains=" + encodeURIComponent("" + telegramChannelContains) + "&";
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
let options_: RequestInit = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Accept": "application/json"
|
||||
}
|
||||
};
|
||||
|
||||
return this.transformOptions(options_).then(transformedOptions_ => {
|
||||
return this.http.fetch(url_, transformedOptions_);
|
||||
}).then((_response: Response) => {
|
||||
return this.processAdmin_GetUsersPaginated(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processAdmin_GetUsersPaginated(response: Response): Promise<PaginatedUsersResponse> {
|
||||
const status = response.status;
|
||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||
if (status === 200) {
|
||||
return response.text().then((_responseText) => {
|
||||
let result200: any = null;
|
||||
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as PaginatedUsersResponse;
|
||||
return result200;
|
||||
});
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
});
|
||||
}
|
||||
return Promise.resolve<PaginatedUsersResponse>(null as any);
|
||||
}
|
||||
}
|
||||
|
||||
export class BacktestClient extends AuthorizedApiBase {
|
||||
@@ -4525,6 +4582,7 @@ export interface User {
|
||||
telegramChannel?: string | null;
|
||||
ownerWalletAddress?: string | null;
|
||||
isAdmin?: boolean;
|
||||
lastConnectionDate?: Date | null;
|
||||
}
|
||||
|
||||
export interface Balance {
|
||||
@@ -4767,6 +4825,34 @@ export interface BundleBacktestRequestStatusSummary {
|
||||
count?: number;
|
||||
}
|
||||
|
||||
export interface PaginatedUsersResponse {
|
||||
users?: UserListItemResponse[];
|
||||
totalCount?: number;
|
||||
currentPage?: number;
|
||||
pageSize?: number;
|
||||
totalPages?: number;
|
||||
hasNextPage?: boolean;
|
||||
hasPreviousPage?: boolean;
|
||||
}
|
||||
|
||||
export interface UserListItemResponse {
|
||||
id?: number;
|
||||
name?: string;
|
||||
agentName?: string;
|
||||
avatarUrl?: string;
|
||||
telegramChannel?: string;
|
||||
ownerWalletAddress?: string;
|
||||
isAdmin?: boolean;
|
||||
lastConnectionDate?: Date | null;
|
||||
}
|
||||
|
||||
export enum UserSortableColumn {
|
||||
Id = "Id",
|
||||
Name = "Name",
|
||||
OwnerWalletAddress = "OwnerWalletAddress",
|
||||
AgentName = "AgentName",
|
||||
}
|
||||
|
||||
export interface Backtest {
|
||||
id: string;
|
||||
finalPnl: number;
|
||||
|
||||
Reference in New Issue
Block a user