feat: 初始化项目并完成基础功能开发
- 完成项目初始化
- 实现用户注册、登录功能
- 完成用户管理与权限管理模块
- 开发后端 Tracker 服务器项目管理接口
- 实现日志管理接口
Change-Id: Ia4bde1c9ff600352a7ff0caca0cc50b02cad1af7
diff --git a/react-ui/src/services/swagger/index.ts b/react-ui/src/services/swagger/index.ts
new file mode 100644
index 0000000..83cf97c
--- /dev/null
+++ b/react-ui/src/services/swagger/index.ts
@@ -0,0 +1,12 @@
+// @ts-ignore
+/* eslint-disable */
+// API 更新时间:
+// API 唯一标识:
+import * as pet from './pet';
+import * as store from './store';
+import * as user from './user';
+export default {
+ pet,
+ store,
+ user,
+};
diff --git a/react-ui/src/services/swagger/pet.ts b/react-ui/src/services/swagger/pet.ts
new file mode 100644
index 0000000..b887475
--- /dev/null
+++ b/react-ui/src/services/swagger/pet.ts
@@ -0,0 +1,153 @@
+// @ts-ignore
+/* eslint-disable */
+import { request } from '@umijs/max';
+
+/** Update an existing pet PUT /pet */
+export async function updatePet(body: API.Pet, options?: { [key: string]: any }) {
+ return request<any>('/pet', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Add a new pet to the store POST /pet */
+export async function addPet(body: API.Pet, options?: { [key: string]: any }) {
+ return request<any>('/pet', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Find pet by ID Returns a single pet GET /pet/${param0} */
+export async function getPetById(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.getPetByIdParams,
+ options?: { [key: string]: any },
+) {
+ const { petId: param0, ...queryParams } = params;
+ return request<API.Pet>(`/pet/${param0}`, {
+ method: 'GET',
+ params: { ...queryParams },
+ ...(options || {}),
+ });
+}
+
+/** Updates a pet in the store with form data POST /pet/${param0} */
+export async function updatePetWithForm(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.updatePetWithFormParams,
+ body: { name?: string; status?: string },
+ options?: { [key: string]: any },
+) {
+ const { petId: param0, ...queryParams } = params;
+ const formData = new FormData();
+
+ Object.keys(body).forEach((ele) => {
+ const item = (body as any)[ele];
+
+ if (item !== undefined && item !== null) {
+ formData.append(
+ ele,
+ typeof item === 'object' && !(item instanceof File) ? JSON.stringify(item) : item,
+ );
+ }
+ });
+
+ return request<any>(`/pet/${param0}`, {
+ method: 'POST',
+ params: { ...queryParams },
+ data: formData,
+ ...(options || {}),
+ });
+}
+
+/** Deletes a pet DELETE /pet/${param0} */
+export async function deletePet(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.deletePetParams & {
+ // header
+ api_key?: string;
+ },
+ options?: { [key: string]: any },
+) {
+ const { petId: param0, ...queryParams } = params;
+ return request<any>(`/pet/${param0}`, {
+ method: 'DELETE',
+ headers: {},
+ params: { ...queryParams },
+ ...(options || {}),
+ });
+}
+
+/** uploads an image POST /pet/${param0}/uploadImage */
+export async function uploadFile(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.uploadFileParams,
+ body: { additionalMetadata?: string; file?: string },
+ file?: File,
+ options?: { [key: string]: any },
+) {
+ const { petId: param0, ...queryParams } = params;
+ const formData = new FormData();
+
+ if (file) {
+ formData.append('file', file);
+ }
+
+ Object.keys(body).forEach((ele) => {
+ const item = (body as any)[ele];
+
+ if (item !== undefined && item !== null) {
+ formData.append(
+ ele,
+ typeof item === 'object' && !(item instanceof File) ? JSON.stringify(item) : item,
+ );
+ }
+ });
+
+ return request<API.ApiResponse>(`/pet/${param0}/uploadImage`, {
+ method: 'POST',
+ params: { ...queryParams },
+ data: formData,
+ requestType: 'form',
+ ...(options || {}),
+ });
+}
+
+/** Finds Pets by status Multiple status values can be provided with comma separated strings GET /pet/findByStatus */
+export async function findPetsByStatus(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.findPetsByStatusParams,
+ options?: { [key: string]: any },
+) {
+ return request<API.Pet[]>('/pet/findByStatus', {
+ method: 'GET',
+ params: {
+ ...params,
+ },
+ ...(options || {}),
+ });
+}
+
+/** Finds Pets by tags Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. GET /pet/findByTags */
+export async function findPetsByTags(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.findPetsByTagsParams,
+ options?: { [key: string]: any },
+) {
+ return request<API.Pet[]>('/pet/findByTags', {
+ method: 'GET',
+ params: {
+ ...params,
+ },
+ ...(options || {}),
+ });
+}
diff --git a/react-ui/src/services/swagger/store.ts b/react-ui/src/services/swagger/store.ts
new file mode 100644
index 0000000..b9c689a
--- /dev/null
+++ b/react-ui/src/services/swagger/store.ts
@@ -0,0 +1,48 @@
+// @ts-ignore
+/* eslint-disable */
+import { request } from '@umijs/max';
+
+/** Returns pet inventories by status Returns a map of status codes to quantities GET /store/inventory */
+export async function getInventory(options?: { [key: string]: any }) {
+ return request<Record<string, any>>('/store/inventory', {
+ method: 'GET',
+ ...(options || {}),
+ });
+}
+
+/** Place an order for a pet POST /store/order */
+export async function placeOrder(body: API.Order, options?: { [key: string]: any }) {
+ return request<API.Order>('/store/order', {
+ method: 'POST',
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Find purchase order by ID For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions GET /store/order/${param0} */
+export async function getOrderById(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.getOrderByIdParams,
+ options?: { [key: string]: any },
+) {
+ const { orderId: param0, ...queryParams } = params;
+ return request<API.Order>(`/store/order/${param0}`, {
+ method: 'GET',
+ params: { ...queryParams },
+ ...(options || {}),
+ });
+}
+
+/** Delete purchase order by ID For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors DELETE /store/order/${param0} */
+export async function deleteOrder(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.deleteOrderParams,
+ options?: { [key: string]: any },
+) {
+ const { orderId: param0, ...queryParams } = params;
+ return request<any>(`/store/order/${param0}`, {
+ method: 'DELETE',
+ params: { ...queryParams },
+ ...(options || {}),
+ });
+}
diff --git a/react-ui/src/services/swagger/typings.d.ts b/react-ui/src/services/swagger/typings.d.ts
new file mode 100644
index 0000000..d06bcfc
--- /dev/null
+++ b/react-ui/src/services/swagger/typings.d.ts
@@ -0,0 +1,112 @@
+declare namespace API {
+ type ApiResponse = {
+ code?: number;
+ type?: string;
+ message?: string;
+ };
+
+ type Category = {
+ id?: number;
+ name?: string;
+ };
+
+ type deleteOrderParams = {
+ /** ID of the order that needs to be deleted */
+ orderId: number;
+ };
+
+ type deletePetParams = {
+ api_key?: string;
+ /** Pet id to delete */
+ petId: number;
+ };
+
+ type deleteUserParams = {
+ /** The name that needs to be deleted */
+ username: string;
+ };
+
+ type findPetsByStatusParams = {
+ /** Status values that need to be considered for filter */
+ status: ('available' | 'pending' | 'sold')[];
+ };
+
+ type findPetsByTagsParams = {
+ /** Tags to filter by */
+ tags: string[];
+ };
+
+ type getOrderByIdParams = {
+ /** ID of pet that needs to be fetched */
+ orderId: number;
+ };
+
+ type getPetByIdParams = {
+ /** ID of pet to return */
+ petId: number;
+ };
+
+ type getUserByNameParams = {
+ /** The name that needs to be fetched. Use user1 for testing. */
+ username: string;
+ };
+
+ type loginUserParams = {
+ /** The user name for login */
+ username: string;
+ /** The password for login in clear text */
+ password: string;
+ };
+
+ type Order = {
+ id?: number;
+ petId?: number;
+ quantity?: number;
+ shipDate?: string;
+ /** Order Status */
+ status?: 'placed' | 'approved' | 'delivered';
+ complete?: boolean;
+ };
+
+ type Pet = {
+ id?: number;
+ category?: Category;
+ name: string;
+ photoUrls: string[];
+ tags?: Tag[];
+ /** pet status in the store */
+ status?: 'available' | 'pending' | 'sold';
+ };
+
+ type Tag = {
+ id?: number;
+ name?: string;
+ };
+
+ type updatePetWithFormParams = {
+ /** ID of pet that needs to be updated */
+ petId: number;
+ };
+
+ type updateUserParams = {
+ /** name that need to be updated */
+ username: string;
+ };
+
+ type uploadFileParams = {
+ /** ID of pet to update */
+ petId: number;
+ };
+
+ type User = {
+ id?: number;
+ username?: string;
+ firstName?: string;
+ lastName?: string;
+ email?: string;
+ password?: string;
+ phone?: string;
+ /** User Status */
+ userStatus?: number;
+ };
+}
diff --git a/react-ui/src/services/swagger/user.ts b/react-ui/src/services/swagger/user.ts
new file mode 100644
index 0000000..4dd6f42
--- /dev/null
+++ b/react-ui/src/services/swagger/user.ts
@@ -0,0 +1,100 @@
+// @ts-ignore
+/* eslint-disable */
+import { request } from '@umijs/max';
+
+/** Create user This can only be done by the logged in user. POST /user */
+export async function createUser(body: API.User, options?: { [key: string]: any }) {
+ return request<any>('/user', {
+ method: 'POST',
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Get user by user name GET /user/${param0} */
+export async function getUserByName(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.getUserByNameParams,
+ options?: { [key: string]: any },
+) {
+ const { username: param0, ...queryParams } = params;
+ return request<API.User>(`/user/${param0}`, {
+ method: 'GET',
+ params: { ...queryParams },
+ ...(options || {}),
+ });
+}
+
+/** Updated user This can only be done by the logged in user. PUT /user/${param0} */
+export async function updateUser(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.updateUserParams,
+ body: API.User,
+ options?: { [key: string]: any },
+) {
+ const { username: param0, ...queryParams } = params;
+ return request<any>(`/user/${param0}`, {
+ method: 'PUT',
+ params: { ...queryParams },
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Delete user This can only be done by the logged in user. DELETE /user/${param0} */
+export async function deleteUser(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.deleteUserParams,
+ options?: { [key: string]: any },
+) {
+ const { username: param0, ...queryParams } = params;
+ return request<any>(`/user/${param0}`, {
+ method: 'DELETE',
+ params: { ...queryParams },
+ ...(options || {}),
+ });
+}
+
+/** Creates list of users with given input array POST /user/createWithArray */
+export async function createUsersWithArrayInput(
+ body: API.User[],
+ options?: { [key: string]: any },
+) {
+ return request<any>('/user/createWithArray', {
+ method: 'POST',
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Creates list of users with given input array POST /user/createWithList */
+export async function createUsersWithListInput(body: API.User[], options?: { [key: string]: any }) {
+ return request<any>('/user/createWithList', {
+ method: 'POST',
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Logs user into the system GET /user/login */
+export async function loginUser(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.loginUserParams,
+ options?: { [key: string]: any },
+) {
+ return request<string>('/user/login', {
+ method: 'GET',
+ params: {
+ ...params,
+ },
+ ...(options || {}),
+ });
+}
+
+/** Logs out current logged in user session GET /user/logout */
+export async function logoutUser(options?: { [key: string]: any }) {
+ return request<any>('/user/logout', {
+ method: 'GET',
+ ...(options || {}),
+ });
+}