Enhance user settings management by adding new properties and updating related functionality
This commit introduces additional user settings properties, including TrendStrongAgreementThreshold, SignalAgreementThreshold, AllowSignalTrendOverride, and DefaultExchange, to the User entity and associated DTOs. The UserController and UserService are updated to handle these new settings, allowing users to customize their trading configurations more effectively. Database migrations are also included to ensure proper schema updates for the new fields.
This commit is contained in:
@@ -4414,6 +4414,45 @@ export class UserClient extends AuthorizedApiBase {
|
||||
}
|
||||
return Promise.resolve<string>(null as any);
|
||||
}
|
||||
|
||||
user_UpdateUserSettings(settings: UpdateUserSettingsRequest): Promise<User> {
|
||||
let url_ = this.baseUrl + "/User/settings";
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
const content_ = JSON.stringify(settings);
|
||||
|
||||
let options_: RequestInit = {
|
||||
body: content_,
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json"
|
||||
}
|
||||
};
|
||||
|
||||
return this.transformOptions(options_).then(transformedOptions_ => {
|
||||
return this.http.fetch(url_, transformedOptions_);
|
||||
}).then((_response: Response) => {
|
||||
return this.processUser_UpdateUserSettings(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processUser_UpdateUserSettings(response: Response): Promise<User> {
|
||||
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 User;
|
||||
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<User>(null as any);
|
||||
}
|
||||
}
|
||||
|
||||
export class WhitelistClient extends AuthorizedApiBase {
|
||||
@@ -4591,6 +4630,24 @@ export interface User {
|
||||
ownerWalletAddress?: string | null;
|
||||
isAdmin?: boolean;
|
||||
lastConnectionDate?: Date | null;
|
||||
lowEthAmountAlert?: number | null;
|
||||
enableAutoswap?: boolean;
|
||||
autoswapAmount?: number | null;
|
||||
maxWaitingTimeForPositionToGetFilledSeconds?: number | null;
|
||||
maxTxnGasFeePerPosition?: number | null;
|
||||
isGmxEnabled?: boolean;
|
||||
minimumConfidence?: Confidence | null;
|
||||
trendStrongAgreementThreshold?: number | null;
|
||||
signalAgreementThreshold?: number | null;
|
||||
allowSignalTrendOverride?: boolean | null;
|
||||
defaultExchange?: TradingExchanges | null;
|
||||
}
|
||||
|
||||
export enum Confidence {
|
||||
Low = "Low",
|
||||
Medium = "Medium",
|
||||
High = "High",
|
||||
None = "None",
|
||||
}
|
||||
|
||||
export interface Balance {
|
||||
@@ -5128,13 +5185,6 @@ export enum SignalStatus {
|
||||
Expired = "Expired",
|
||||
}
|
||||
|
||||
export enum Confidence {
|
||||
Low = "Low",
|
||||
Medium = "Medium",
|
||||
High = "High",
|
||||
None = "None",
|
||||
}
|
||||
|
||||
export interface Candle {
|
||||
exchange: TradingExchanges;
|
||||
ticker: Ticker;
|
||||
@@ -6032,6 +6082,20 @@ export interface LoginRequest {
|
||||
ownerWalletAddress?: string | null;
|
||||
}
|
||||
|
||||
export interface UpdateUserSettingsRequest {
|
||||
lowEthAmountAlert?: number | null;
|
||||
enableAutoswap?: boolean | null;
|
||||
autoswapAmount?: number | null;
|
||||
maxWaitingTimeForPositionToGetFilledSeconds?: number | null;
|
||||
maxTxnGasFeePerPosition?: number | null;
|
||||
isGmxEnabled?: boolean | null;
|
||||
minimumConfidence?: Confidence | null;
|
||||
trendStrongAgreementThreshold?: number | null;
|
||||
signalAgreementThreshold?: number | null;
|
||||
allowSignalTrendOverride?: boolean | null;
|
||||
defaultExchange?: TradingExchanges | null;
|
||||
}
|
||||
|
||||
export interface PaginatedWhitelistAccountsResponse {
|
||||
accounts?: WhitelistAccount[] | null;
|
||||
totalCount?: number;
|
||||
|
||||
@@ -49,6 +49,24 @@ export interface User {
|
||||
ownerWalletAddress?: string | null;
|
||||
isAdmin?: boolean;
|
||||
lastConnectionDate?: Date | null;
|
||||
lowEthAmountAlert?: number | null;
|
||||
enableAutoswap?: boolean;
|
||||
autoswapAmount?: number | null;
|
||||
maxWaitingTimeForPositionToGetFilledSeconds?: number | null;
|
||||
maxTxnGasFeePerPosition?: number | null;
|
||||
isGmxEnabled?: boolean;
|
||||
minimumConfidence?: Confidence | null;
|
||||
trendStrongAgreementThreshold?: number | null;
|
||||
signalAgreementThreshold?: number | null;
|
||||
allowSignalTrendOverride?: boolean | null;
|
||||
defaultExchange?: TradingExchanges | null;
|
||||
}
|
||||
|
||||
export enum Confidence {
|
||||
Low = "Low",
|
||||
Medium = "Medium",
|
||||
High = "High",
|
||||
None = "None",
|
||||
}
|
||||
|
||||
export interface Balance {
|
||||
@@ -586,13 +604,6 @@ export enum SignalStatus {
|
||||
Expired = "Expired",
|
||||
}
|
||||
|
||||
export enum Confidence {
|
||||
Low = "Low",
|
||||
Medium = "Medium",
|
||||
High = "High",
|
||||
None = "None",
|
||||
}
|
||||
|
||||
export interface Candle {
|
||||
exchange: TradingExchanges;
|
||||
ticker: Ticker;
|
||||
@@ -1490,6 +1501,20 @@ export interface LoginRequest {
|
||||
ownerWalletAddress?: string | null;
|
||||
}
|
||||
|
||||
export interface UpdateUserSettingsRequest {
|
||||
lowEthAmountAlert?: number | null;
|
||||
enableAutoswap?: boolean | null;
|
||||
autoswapAmount?: number | null;
|
||||
maxWaitingTimeForPositionToGetFilledSeconds?: number | null;
|
||||
maxTxnGasFeePerPosition?: number | null;
|
||||
isGmxEnabled?: boolean | null;
|
||||
minimumConfidence?: Confidence | null;
|
||||
trendStrongAgreementThreshold?: number | null;
|
||||
signalAgreementThreshold?: number | null;
|
||||
allowSignalTrendOverride?: boolean | null;
|
||||
defaultExchange?: TradingExchanges | null;
|
||||
}
|
||||
|
||||
export interface PaginatedWhitelistAccountsResponse {
|
||||
accounts?: WhitelistAccount[] | null;
|
||||
totalCount?: number;
|
||||
|
||||
Reference in New Issue
Block a user