mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-02-06 11:40:28 -05:00
🐛 fix(api): Rename app-related functions and types to application for consistency
This commit is contained in:
parent
5e5e4edd2e
commit
9d8b814212
@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { getAppConfig, updateAppConfig } from '@/services/admin/app';
|
||||
import { getApplicationConfig, updateApplicationConfig } from '@/services/admin/system';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { Icon } from '@iconify/react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
@ -55,9 +55,9 @@ export default function ConfigForm() {
|
||||
});
|
||||
|
||||
const { data, refetch } = useQuery({
|
||||
queryKey: ['getAppConfig'],
|
||||
queryKey: ['getApplicationConfig'],
|
||||
queryFn: async () => {
|
||||
const { data } = await getAppConfig();
|
||||
const { data } = await getApplicationConfig();
|
||||
return data.data;
|
||||
},
|
||||
});
|
||||
@ -74,7 +74,7 @@ export default function ConfigForm() {
|
||||
async function onSubmit(values: FormSchema) {
|
||||
setLoading(true);
|
||||
try {
|
||||
await updateAppConfig(values as API.AppConfig);
|
||||
await updateApplicationConfig(values as API.ApplicationConfig);
|
||||
toast.success(t('updateSuccess'));
|
||||
refetch();
|
||||
setOpen(false);
|
||||
|
||||
@ -231,6 +231,16 @@ export default function SubscribeAppForm<
|
||||
name: 'is_default',
|
||||
type: 'boolean',
|
||||
placeholder: t('defaultVersion'),
|
||||
calculateValue: (value) => {
|
||||
const newField = field.value?.map((item) => {
|
||||
if (item.is_default) {
|
||||
item.is_default = false;
|
||||
}
|
||||
return item;
|
||||
});
|
||||
form.setValue(field.name, newField);
|
||||
return value;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'url',
|
||||
|
||||
@ -1,101 +0,0 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** get app config GET /v1/admin/app/config */
|
||||
export async function getAppConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.AppConfig }>('/v1/admin/app/config', {
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** update app config PUT /v1/admin/app/config */
|
||||
export async function updateAppConfig(body: API.AppConfig, options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: any }>('/v1/admin/app/config', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** update app version PUT /v1/admin/app/version */
|
||||
export async function updateAppVersion(
|
||||
body: API.UpdateAppVersionRequest,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: any }>('/v1/admin/app/version', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** create app version POST /v1/admin/app/version */
|
||||
export async function createAppVersion(
|
||||
body: API.CreateAppVersionRequest,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: any }>('/v1/admin/app/version', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** delete app version DELETE /v1/admin/app/version */
|
||||
export async function deleteAppVersionInfo(
|
||||
body: API.DeleteAppVersionRequest,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: any }>('/v1/admin/app/version', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** set default app version PUT /v1/admin/app/version_default */
|
||||
export async function setDefaultAppVersionInfo(
|
||||
body: API.DefaultAppVersionRequest,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: any }>('/v1/admin/app/version_default', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** query app version info GET /v1/admin/app/version_list */
|
||||
export async function getAppVersionList(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.GetAppVersionListParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: API.GetAppVersionListResponse }>(
|
||||
'/v1/admin/app/version_list',
|
||||
{
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -1,9 +1,8 @@
|
||||
// @ts-ignore
|
||||
|
||||
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as announcement from './announcement';
|
||||
import * as app from './app';
|
||||
import * as console from './console';
|
||||
import * as coupon from './coupon';
|
||||
import * as document from './document';
|
||||
@ -18,7 +17,6 @@ import * as tool from './tool';
|
||||
import * as user from './user';
|
||||
export default {
|
||||
announcement,
|
||||
app,
|
||||
console,
|
||||
coupon,
|
||||
document,
|
||||
|
||||
@ -58,6 +58,32 @@ export async function deleteApplication(
|
||||
});
|
||||
}
|
||||
|
||||
/** get application config GET /v1/admin/system/application_config */
|
||||
export async function getApplicationConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.ApplicationConfig }>(
|
||||
'/v1/admin/system/application_config',
|
||||
{
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** update application config PUT /v1/admin/system/application_config */
|
||||
export async function updateApplicationConfig(
|
||||
body: API.ApplicationConfig,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: any }>('/v1/admin/system/application_config', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** Update application version PUT /v1/admin/system/application_version */
|
||||
export async function updateApplicationVersion(
|
||||
body: API.UpdateApplicationVersionRequest,
|
||||
|
||||
63
apps/admin/services/admin/typings.d.ts
vendored
63
apps/admin/services/admin/typings.d.ts
vendored
@ -18,14 +18,6 @@ declare namespace API {
|
||||
updated_at: number;
|
||||
};
|
||||
|
||||
type AppConfig = {
|
||||
name: string;
|
||||
domains: string[];
|
||||
describe: string;
|
||||
startup_picture: string;
|
||||
startup_picture_skip_time: number;
|
||||
};
|
||||
|
||||
type Application = {
|
||||
id: number;
|
||||
icon: string;
|
||||
@ -34,6 +26,12 @@ declare namespace API {
|
||||
subscribe_type: string;
|
||||
};
|
||||
|
||||
type ApplicationConfig = {
|
||||
domains: string[];
|
||||
startup_picture: string;
|
||||
startup_picture_skip_time: number;
|
||||
};
|
||||
|
||||
type ApplicationPlatform = {
|
||||
ios?: ApplicationVersion[];
|
||||
mac?: ApplicationVersion[];
|
||||
@ -64,15 +62,6 @@ declare namespace API {
|
||||
is_default: boolean;
|
||||
};
|
||||
|
||||
type AppVersion = {
|
||||
id: number;
|
||||
os: string;
|
||||
version: string;
|
||||
download_url: string;
|
||||
describe: string;
|
||||
default_version: boolean;
|
||||
};
|
||||
|
||||
type AuthConfig = {
|
||||
sms: SmsAuthenticateConfig;
|
||||
email: EmailAuthticateConfig;
|
||||
@ -145,13 +134,6 @@ declare namespace API {
|
||||
application_id: number;
|
||||
};
|
||||
|
||||
type CreateAppVersionRequest = {
|
||||
os: string;
|
||||
version: string;
|
||||
download_url: string;
|
||||
describe: string;
|
||||
};
|
||||
|
||||
type CreateCouponRequest = {
|
||||
name: string;
|
||||
code?: string;
|
||||
@ -267,10 +249,6 @@ declare namespace API {
|
||||
currency_symbol: string;
|
||||
};
|
||||
|
||||
type DefaultAppVersionRequest = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type DeleteAnnouncementRequest = {
|
||||
id: number;
|
||||
};
|
||||
@ -283,10 +261,6 @@ declare namespace API {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type DeleteAppVersionRequest = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type DeleteCouponRequest = {
|
||||
id: number;
|
||||
};
|
||||
@ -398,23 +372,6 @@ declare namespace API {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type GetAppVersionListParams = {
|
||||
page: number;
|
||||
size: number;
|
||||
os?: string;
|
||||
};
|
||||
|
||||
type GetAppVersionListRequest = {
|
||||
page: number;
|
||||
size: number;
|
||||
os?: string;
|
||||
};
|
||||
|
||||
type GetAppVersionListResponse = {
|
||||
total: number;
|
||||
list: AppVersion[];
|
||||
};
|
||||
|
||||
type GetCouponListParams = {
|
||||
page: number;
|
||||
size: number;
|
||||
@ -1082,14 +1039,6 @@ declare namespace API {
|
||||
application_id: number;
|
||||
};
|
||||
|
||||
type UpdateAppVersionRequest = {
|
||||
id: number;
|
||||
os: string;
|
||||
version: string;
|
||||
download_url: string;
|
||||
describe: string;
|
||||
};
|
||||
|
||||
type UpdateCouponRequest = {
|
||||
id: number;
|
||||
name: string;
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** Get Tos Content GET /v1/common/app/info */
|
||||
export async function getAppInfo(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.GetAppInfoResponse }>('/v1/common/app/info', {
|
||||
/** Get Tos Content GET /v1/common/application */
|
||||
export async function getApplication(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.GetAppcationResponse }>('/v1/common/application', {
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
});
|
||||
|
||||
29
apps/admin/services/common/typings.d.ts
vendored
29
apps/admin/services/common/typings.d.ts
vendored
@ -10,14 +10,6 @@ declare namespace API {
|
||||
updated_at: number;
|
||||
};
|
||||
|
||||
type AppConfig = {
|
||||
name: string;
|
||||
domains: string[];
|
||||
describe: string;
|
||||
startup_picture: string;
|
||||
startup_picture_skip_time: number;
|
||||
};
|
||||
|
||||
type Application = {
|
||||
id: number;
|
||||
icon: string;
|
||||
@ -26,6 +18,12 @@ declare namespace API {
|
||||
subscribe_type: string;
|
||||
};
|
||||
|
||||
type ApplicationConfig = {
|
||||
domains: string[];
|
||||
startup_picture: string;
|
||||
startup_picture_skip_time: number;
|
||||
};
|
||||
|
||||
type ApplicationPlatform = {
|
||||
ios?: ApplicationVersion[];
|
||||
mac?: ApplicationVersion[];
|
||||
@ -56,15 +54,6 @@ declare namespace API {
|
||||
is_default: boolean;
|
||||
};
|
||||
|
||||
type AppVersion = {
|
||||
id: number;
|
||||
os: string;
|
||||
version: string;
|
||||
download_url: string;
|
||||
describe: string;
|
||||
default_version: boolean;
|
||||
};
|
||||
|
||||
type AuthConfig = {
|
||||
sms: SmsAuthenticateConfig;
|
||||
email: EmailAuthticateConfig;
|
||||
@ -151,9 +140,9 @@ declare namespace API {
|
||||
created_at: number;
|
||||
};
|
||||
|
||||
type GetAppInfoResponse = {
|
||||
config: AppConfig;
|
||||
versions: AppVersion[];
|
||||
type GetAppcationResponse = {
|
||||
config: ApplicationConfig;
|
||||
applications: ApplicationResponseInfo[];
|
||||
};
|
||||
|
||||
type GetGlobalConfigResponse = {
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** Get Tos Content GET /v1/common/app/info */
|
||||
export async function getAppInfo(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.GetAppInfoResponse }>('/v1/common/app/info', {
|
||||
/** Get Tos Content GET /v1/common/application */
|
||||
export async function getApplication(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.GetAppcationResponse }>('/v1/common/application', {
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
});
|
||||
|
||||
29
apps/user/services/common/typings.d.ts
vendored
29
apps/user/services/common/typings.d.ts
vendored
@ -10,14 +10,6 @@ declare namespace API {
|
||||
updated_at: number;
|
||||
};
|
||||
|
||||
type AppConfig = {
|
||||
name: string;
|
||||
domains: string[];
|
||||
describe: string;
|
||||
startup_picture: string;
|
||||
startup_picture_skip_time: number;
|
||||
};
|
||||
|
||||
type Application = {
|
||||
id: number;
|
||||
icon: string;
|
||||
@ -26,6 +18,12 @@ declare namespace API {
|
||||
subscribe_type: string;
|
||||
};
|
||||
|
||||
type ApplicationConfig = {
|
||||
domains: string[];
|
||||
startup_picture: string;
|
||||
startup_picture_skip_time: number;
|
||||
};
|
||||
|
||||
type ApplicationPlatform = {
|
||||
ios?: ApplicationVersion[];
|
||||
mac?: ApplicationVersion[];
|
||||
@ -56,15 +54,6 @@ declare namespace API {
|
||||
is_default: boolean;
|
||||
};
|
||||
|
||||
type AppVersion = {
|
||||
id: number;
|
||||
os: string;
|
||||
version: string;
|
||||
download_url: string;
|
||||
describe: string;
|
||||
default_version: boolean;
|
||||
};
|
||||
|
||||
type AuthConfig = {
|
||||
sms: SmsAuthenticateConfig;
|
||||
email: EmailAuthticateConfig;
|
||||
@ -151,9 +140,9 @@ declare namespace API {
|
||||
created_at: number;
|
||||
};
|
||||
|
||||
type GetAppInfoResponse = {
|
||||
config: AppConfig;
|
||||
versions: AppVersion[];
|
||||
type GetAppcationResponse = {
|
||||
config: ApplicationConfig;
|
||||
applications: ApplicationResponseInfo[];
|
||||
};
|
||||
|
||||
type GetGlobalConfigResponse = {
|
||||
|
||||
23
apps/user/services/user/typings.d.ts
vendored
23
apps/user/services/user/typings.d.ts
vendored
@ -10,14 +10,6 @@ declare namespace API {
|
||||
updated_at: number;
|
||||
};
|
||||
|
||||
type AppConfig = {
|
||||
name: string;
|
||||
domains: string[];
|
||||
describe: string;
|
||||
startup_picture: string;
|
||||
startup_picture_skip_time: number;
|
||||
};
|
||||
|
||||
type Application = {
|
||||
id: number;
|
||||
icon: string;
|
||||
@ -26,6 +18,12 @@ declare namespace API {
|
||||
subscribe_type: string;
|
||||
};
|
||||
|
||||
type ApplicationConfig = {
|
||||
domains: string[];
|
||||
startup_picture: string;
|
||||
startup_picture_skip_time: number;
|
||||
};
|
||||
|
||||
type ApplicationPlatform = {
|
||||
ios?: ApplicationVersion[];
|
||||
mac?: ApplicationVersion[];
|
||||
@ -56,15 +54,6 @@ declare namespace API {
|
||||
is_default: boolean;
|
||||
};
|
||||
|
||||
type AppVersion = {
|
||||
id: number;
|
||||
os: string;
|
||||
version: string;
|
||||
download_url: string;
|
||||
describe: string;
|
||||
default_version: boolean;
|
||||
};
|
||||
|
||||
type AuthConfig = {
|
||||
sms: SmsAuthenticateConfig;
|
||||
email: EmailAuthticateConfig;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user