From 2b507f932952867b095abd7826cd98b9c2fbb933 Mon Sep 17 00:00:00 2001 From: MiniDay <372403923@qq.com> Date: Thu, 6 Apr 2023 05:13:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BC=80=E5=8F=91=E4=B8=AD...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blog/config/AuthenticationFilter.java | 1 + .../blog/config/BlogExceptionHandler.java | 7 +- .../config/security/UserAuditorAware.java | 2 - .../application/blog/entity/AttachEntity.java | 3 + .../blog/entity/BlogAttachEntity.java | 15 +- .../blog/entity/repo/AttachRepository.java | 1 + .../blog/service/impl/SettingService.java | 7 +- .../blog/vo/blog/BlogInfoResponseVO.java | 2 +- .../blog/vo/user/UserLoginRequireVO.java | 1 - .../src/swagger/.swagger-codegen/VERSION | 2 +- .../src/swagger/apis/attach-controller-api.ts | 232 +++++++++++++----- .../swagger/models/attach-attach-idbody.ts | 2 +- .../swagger/models/attach-info-response-vo.ts | 11 +- .../swagger/models/blog-update-require-vo.ts | 6 - blog-frontend/src/swagger/models/index.ts | 1 + .../response-voattach-info-response-vo.ts | 39 +++ .../src/swagger/models/v1-attach-body.ts | 2 +- 17 files changed, 252 insertions(+), 82 deletions(-) create mode 100644 blog-frontend/src/swagger/models/response-voattach-info-response-vo.ts diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/config/AuthenticationFilter.java b/blog-backend/src/main/java/cn/hamster3/application/blog/config/AuthenticationFilter.java index 5b05f25..e3ee38e 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/config/AuthenticationFilter.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/config/AuthenticationFilter.java @@ -35,6 +35,7 @@ public class AuthenticationFilter extends OncePerRequestFilter { } SecurityContext context = SecurityContextHolder.getContext(); context.setAuthentication(authentication); + log.info("set authentication info to security context: {}", authentication); filterChain.doFilter(request, response); } } diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/config/BlogExceptionHandler.java b/blog-backend/src/main/java/cn/hamster3/application/blog/config/BlogExceptionHandler.java index 07ec484..2511c96 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/config/BlogExceptionHandler.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/config/BlogExceptionHandler.java @@ -40,8 +40,9 @@ public class BlogExceptionHandler { @ExceptionHandler(NestedRuntimeException.class) public ResponseVO onNestedRuntimeException(NestedRuntimeException e) { - if (e.getRootCause() != null) { - if (e.getRootCause() instanceof ConstraintViolationException ve) { + Throwable rootCause = e.getRootCause(); + if (rootCause != null) { + if (rootCause instanceof ConstraintViolationException ve) { return ResponseVO.failed(ve.getConstraintViolations() .stream() .findFirst() @@ -49,7 +50,7 @@ public class BlogExceptionHandler { .orElse("未知错误!") ); } - return ResponseVO.failed(e.getRootCause().getMessage()); + return ResponseVO.failed(rootCause.getMessage()); } return ResponseVO.failed(e.getMessage()); } diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/config/security/UserAuditorAware.java b/blog-backend/src/main/java/cn/hamster3/application/blog/config/security/UserAuditorAware.java index 065852d..9c6b264 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/config/security/UserAuditorAware.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/config/security/UserAuditorAware.java @@ -4,7 +4,6 @@ import cn.hamster3.application.blog.entity.UserEntity; import cn.hamster3.application.blog.entity.repo.UserRepository; import cn.hamster3.application.blog.util.BlogUtils; import jakarta.annotation.Resource; -import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; import org.springframework.data.domain.AuditorAware; import org.springframework.stereotype.Component; @@ -12,7 +11,6 @@ import org.springframework.stereotype.Component; import java.util.Optional; import java.util.UUID; -@Slf4j @Component public class UserAuditorAware implements AuditorAware { @Resource diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/AttachEntity.java b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/AttachEntity.java index 80e6cc7..e25c5cd 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/AttachEntity.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/AttachEntity.java @@ -3,6 +3,8 @@ package cn.hamster3.application.blog.entity; import jakarta.persistence.*; import lombok.Getter; import lombok.Setter; +import org.hibernate.annotations.JdbcTypeCode; +import org.hibernate.type.SqlTypes; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedBy; @@ -33,6 +35,7 @@ public class AttachEntity { @Lob @Basic(fetch = FetchType.LAZY) @Column(name = "data") + @JdbcTypeCode(SqlTypes.LONG32VARBINARY) private byte[] data; @CreatedBy diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/BlogAttachEntity.java b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/BlogAttachEntity.java index 8cf5604..748b5f3 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/BlogAttachEntity.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/BlogAttachEntity.java @@ -2,6 +2,9 @@ package cn.hamster3.application.blog.entity; import jakarta.persistence.*; import lombok.Getter; +import lombok.Setter; +import org.hibernate.annotations.JdbcTypeCode; +import org.hibernate.type.SqlTypes; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedBy; @@ -20,9 +23,19 @@ public class BlogAttachEntity { @Column(name = "id", nullable = false, updatable = false) private Long id; + @Setter + @Column(name = "name", nullable = false) + private String name; + + @Setter + @Column(name = "content_type", nullable = false) + private String contentType; + + @Setter @Lob @Basic(fetch = FetchType.LAZY) - @Column(name = "data", nullable = false) + @Column(name = "data") + @JdbcTypeCode(SqlTypes.LONG32VARBINARY) private byte[] data; @ManyToOne(optional = false) diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/repo/AttachRepository.java b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/repo/AttachRepository.java index 3a827f6..c016cf9 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/repo/AttachRepository.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/repo/AttachRepository.java @@ -13,6 +13,7 @@ import java.util.UUID; public interface AttachRepository extends JpaRepository, JpaSpecificationExecutor { boolean existsByIdAndCreator_Id(Long id, UUID id1); + @Query("select a from AttachEntity a where a.id = ?1") AttachEntity findByIdWithContent(Long id); diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/SettingService.java b/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/SettingService.java index 42963f5..10ec2fe 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/SettingService.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/SettingService.java @@ -45,10 +45,7 @@ public class SettingService implements ISettingService { @Override public @NotNull ResponseVO> getSettingInfoList(@NotNull Pageable pageable) { - return PageableVO.success( - settingRepo.findAll(pageable) - .map(o -> settingMapper.entityToInfoVO(o)) - ); + return PageableVO.success(settingRepo.findAll(pageable).map(o -> settingMapper.entityToInfoVO(o))); } @Override @@ -75,6 +72,7 @@ public class SettingService implements ISettingService { if (check != null) { return check; } + log.info("prepare update setting: {}", data); for (Map.Entry entry : data.entrySet()) { String id = entry.getKey(); String content = entry.getValue(); @@ -99,6 +97,7 @@ public class SettingService implements ISettingService { if (!settingRepo.existsByIdIgnoreCase(id)) { return ResponseVO.notFound(); } + log.info("prepare delete setting by id: {}", id); settingRepo.deleteByIdIgnoreCase(id); return ResponseVO.success(); } diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/vo/blog/BlogInfoResponseVO.java b/blog-backend/src/main/java/cn/hamster3/application/blog/vo/blog/BlogInfoResponseVO.java index 41cbb91..1158528 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/vo/blog/BlogInfoResponseVO.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/vo/blog/BlogInfoResponseVO.java @@ -1,9 +1,9 @@ package cn.hamster3.application.blog.vo.blog; import cn.hamster3.application.blog.vo.user.UserInfoResponseVO; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Data; -import jakarta.validation.constraints.NotNull; import lombok.NoArgsConstructor; import java.util.Date; diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/vo/user/UserLoginRequireVO.java b/blog-backend/src/main/java/cn/hamster3/application/blog/vo/user/UserLoginRequireVO.java index 196c402..d2fab63 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/vo/user/UserLoginRequireVO.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/vo/user/UserLoginRequireVO.java @@ -5,7 +5,6 @@ import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; - import org.hibernate.validator.constraints.Length; @Data diff --git a/blog-frontend/src/swagger/.swagger-codegen/VERSION b/blog-frontend/src/swagger/.swagger-codegen/VERSION index a254f0a..34ec317 100644 --- a/blog-frontend/src/swagger/.swagger-codegen/VERSION +++ b/blog-frontend/src/swagger/.swagger-codegen/VERSION @@ -1 +1 @@ -3.0.41 \ No newline at end of file +3.0.42 \ No newline at end of file diff --git a/blog-frontend/src/swagger/apis/attach-controller-api.ts b/blog-frontend/src/swagger/apis/attach-controller-api.ts index a5d287c..725cf3c 100644 --- a/blog-frontend/src/swagger/apis/attach-controller-api.ts +++ b/blog-frontend/src/swagger/apis/attach-controller-api.ts @@ -17,6 +17,9 @@ import { Configuration } from '../configuration'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; import { AttachAttachIDBody } from '../models'; +import { ResponseVOAttachInfoResponseVO } from '../models'; +import { ResponseVOLong } from '../models'; +import { ResponseVOPageableVOAttachInfoResponseVO } from '../models'; import { ResponseVOVoid } from '../models'; import { V1AttachBody } from '../models'; /** @@ -27,15 +30,12 @@ export const AttachControllerApiAxiosParamCreator = function (configuration?: Co return { /** * - * @param {V1AttachBody} body + * @summary 新建附件 + * @param {V1AttachBody} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createAttach: async (body: V1AttachBody, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createAttach.'); - } + createAttach: async (body?: V1AttachBody, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/attach/`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); @@ -69,11 +69,12 @@ export const AttachControllerApiAxiosParamCreator = function (configuration?: Co }, /** * - * @param {string} attachID + * @summary 删除附件 + * @param {number} attachID * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteAttach: async (attachID: string, options: AxiosRequestConfig = {}): Promise => { + deleteAttach: async (attachID: number, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'attachID' is not null or undefined if (attachID === null || attachID === undefined) { throw new RequiredError('attachID','Required parameter attachID was null or undefined when calling deleteAttach.'); @@ -108,14 +109,55 @@ export const AttachControllerApiAxiosParamCreator = function (configuration?: Co }, /** * - * @param {string} attachID + * @summary 获取附件内容 + * @param {number} attachID * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getAttach: async (attachID: string, options: AxiosRequestConfig = {}): Promise => { + getAttachContent: async (attachID: number, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'attachID' is not null or undefined if (attachID === null || attachID === undefined) { - throw new RequiredError('attachID','Required parameter attachID was null or undefined when calling getAttach.'); + throw new RequiredError('attachID','Required parameter attachID was null or undefined when calling getAttachContent.'); + } + const localVarPath = `/api/v1/attach/{attachID}/content` + .replace(`{${"attachID"}}`, encodeURIComponent(String(attachID))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary 获取附件信息 + * @param {number} attachID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAttachInfo: async (attachID: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'attachID' is not null or undefined + if (attachID === null || attachID === undefined) { + throw new RequiredError('attachID','Required parameter attachID was null or undefined when calling getAttachInfo.'); } const localVarPath = `/api/v1/attach/{attachID}/` .replace(`{${"attachID"}}`, encodeURIComponent(String(attachID))); @@ -147,10 +189,21 @@ export const AttachControllerApiAxiosParamCreator = function (configuration?: Co }, /** * + * @summary 获取附件列表 + * @param {number} page 页码 + * @param {number} size 大小 * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getAttachList: async (options: AxiosRequestConfig = {}): Promise => { + getAttachList: async (page: number, size: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'page' is not null or undefined + if (page === null || page === undefined) { + throw new RequiredError('page','Required parameter page was null or undefined when calling getAttachList.'); + } + // verify required parameter 'size' is not null or undefined + if (size === null || size === undefined) { + throw new RequiredError('size','Required parameter size was null or undefined when calling getAttachList.'); + } const localVarPath = `/api/v1/attach/`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); @@ -162,6 +215,14 @@ export const AttachControllerApiAxiosParamCreator = function (configuration?: Co const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + if (page !== undefined) { + localVarQueryParameter['page'] = page; + } + + if (size !== undefined) { + localVarQueryParameter['size'] = size; + } + const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); @@ -180,19 +241,16 @@ export const AttachControllerApiAxiosParamCreator = function (configuration?: Co }, /** * - * @param {AttachAttachIDBody} body - * @param {string} attachID + * @summary 更新附件 + * @param {number} attachID + * @param {AttachAttachIDBody} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - modifyAttach: async (body: AttachAttachIDBody, attachID: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling modifyAttach.'); - } + updateAttach: async (attachID: number, body?: AttachAttachIDBody, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'attachID' is not null or undefined if (attachID === null || attachID === undefined) { - throw new RequiredError('attachID','Required parameter attachID was null or undefined when calling modifyAttach.'); + throw new RequiredError('attachID','Required parameter attachID was null or undefined when calling updateAttach.'); } const localVarPath = `/api/v1/attach/{attachID}/` .replace(`{${"attachID"}}`, encodeURIComponent(String(attachID))); @@ -237,11 +295,12 @@ export const AttachControllerApiFp = function(configuration?: Configuration) { return { /** * - * @param {V1AttachBody} body + * @summary 新建附件 + * @param {V1AttachBody} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async createAttach(body: V1AttachBody, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + async createAttach(body?: V1AttachBody, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).createAttach(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; @@ -250,11 +309,12 @@ export const AttachControllerApiFp = function(configuration?: Configuration) { }, /** * - * @param {string} attachID + * @summary 删除附件 + * @param {number} attachID * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async deleteAttach(attachID: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + async deleteAttach(attachID: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).deleteAttach(attachID, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; @@ -263,12 +323,13 @@ export const AttachControllerApiFp = function(configuration?: Configuration) { }, /** * - * @param {string} attachID + * @summary 获取附件内容 + * @param {number} attachID * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getAttach(attachID: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { - const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).getAttach(attachID, options); + async getAttachContent(attachID: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).getAttachContent(attachID, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); @@ -276,11 +337,13 @@ export const AttachControllerApiFp = function(configuration?: Configuration) { }, /** * + * @summary 获取附件信息 + * @param {number} attachID * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getAttachList(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { - const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).getAttachList(options); + async getAttachInfo(attachID: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).getAttachInfo(attachID, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); @@ -288,13 +351,29 @@ export const AttachControllerApiFp = function(configuration?: Configuration) { }, /** * - * @param {AttachAttachIDBody} body - * @param {string} attachID + * @summary 获取附件列表 + * @param {number} page 页码 + * @param {number} size 大小 * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async modifyAttach(body: AttachAttachIDBody, attachID: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { - const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).modifyAttach(body, attachID, options); + async getAttachList(page: number, size: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).getAttachList(page, size, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary 更新附件 + * @param {number} attachID + * @param {AttachAttachIDBody} [body] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateAttach(attachID: number, body?: AttachAttachIDBody, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).updateAttach(attachID, body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); @@ -311,48 +390,65 @@ export const AttachControllerApiFactory = function (configuration?: Configuratio return { /** * - * @param {V1AttachBody} body + * @summary 新建附件 + * @param {V1AttachBody} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async createAttach(body: V1AttachBody, options?: AxiosRequestConfig): Promise> { + async createAttach(body?: V1AttachBody, options?: AxiosRequestConfig): Promise> { return AttachControllerApiFp(configuration).createAttach(body, options).then((request) => request(axios, basePath)); }, /** * - * @param {string} attachID + * @summary 删除附件 + * @param {number} attachID * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async deleteAttach(attachID: string, options?: AxiosRequestConfig): Promise> { + async deleteAttach(attachID: number, options?: AxiosRequestConfig): Promise> { return AttachControllerApiFp(configuration).deleteAttach(attachID, options).then((request) => request(axios, basePath)); }, /** * - * @param {string} attachID + * @summary 获取附件内容 + * @param {number} attachID * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getAttach(attachID: string, options?: AxiosRequestConfig): Promise> { - return AttachControllerApiFp(configuration).getAttach(attachID, options).then((request) => request(axios, basePath)); + async getAttachContent(attachID: number, options?: AxiosRequestConfig): Promise> { + return AttachControllerApiFp(configuration).getAttachContent(attachID, options).then((request) => request(axios, basePath)); }, /** * + * @summary 获取附件信息 + * @param {number} attachID * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getAttachList(options?: AxiosRequestConfig): Promise> { - return AttachControllerApiFp(configuration).getAttachList(options).then((request) => request(axios, basePath)); + async getAttachInfo(attachID: number, options?: AxiosRequestConfig): Promise> { + return AttachControllerApiFp(configuration).getAttachInfo(attachID, options).then((request) => request(axios, basePath)); }, /** * - * @param {AttachAttachIDBody} body - * @param {string} attachID + * @summary 获取附件列表 + * @param {number} page 页码 + * @param {number} size 大小 * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async modifyAttach(body: AttachAttachIDBody, attachID: string, options?: AxiosRequestConfig): Promise> { - return AttachControllerApiFp(configuration).modifyAttach(body, attachID, options).then((request) => request(axios, basePath)); + async getAttachList(page: number, size: number, options?: AxiosRequestConfig): Promise> { + return AttachControllerApiFp(configuration).getAttachList(page, size, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 更新附件 + * @param {number} attachID + * @param {AttachAttachIDBody} [body] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateAttach(attachID: number, body?: AttachAttachIDBody, options?: AxiosRequestConfig): Promise> { + return AttachControllerApiFp(configuration).updateAttach(attachID, body, options).then((request) => request(axios, basePath)); }, }; }; @@ -366,52 +462,70 @@ export const AttachControllerApiFactory = function (configuration?: Configuratio export class AttachControllerApi extends BaseAPI { /** * - * @param {V1AttachBody} body + * @summary 新建附件 + * @param {V1AttachBody} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AttachControllerApi */ - public async createAttach(body: V1AttachBody, options?: AxiosRequestConfig) : Promise> { + public async createAttach(body?: V1AttachBody, options?: AxiosRequestConfig) : Promise> { return AttachControllerApiFp(this.configuration).createAttach(body, options).then((request) => request(this.axios, this.basePath)); } /** * - * @param {string} attachID + * @summary 删除附件 + * @param {number} attachID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AttachControllerApi */ - public async deleteAttach(attachID: string, options?: AxiosRequestConfig) : Promise> { + public async deleteAttach(attachID: number, options?: AxiosRequestConfig) : Promise> { return AttachControllerApiFp(this.configuration).deleteAttach(attachID, options).then((request) => request(this.axios, this.basePath)); } /** * - * @param {string} attachID + * @summary 获取附件内容 + * @param {number} attachID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AttachControllerApi */ - public async getAttach(attachID: string, options?: AxiosRequestConfig) : Promise> { - return AttachControllerApiFp(this.configuration).getAttach(attachID, options).then((request) => request(this.axios, this.basePath)); + public async getAttachContent(attachID: number, options?: AxiosRequestConfig) : Promise> { + return AttachControllerApiFp(this.configuration).getAttachContent(attachID, options).then((request) => request(this.axios, this.basePath)); } /** * + * @summary 获取附件信息 + * @param {number} attachID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AttachControllerApi */ - public async getAttachList(options?: AxiosRequestConfig) : Promise> { - return AttachControllerApiFp(this.configuration).getAttachList(options).then((request) => request(this.axios, this.basePath)); + public async getAttachInfo(attachID: number, options?: AxiosRequestConfig) : Promise> { + return AttachControllerApiFp(this.configuration).getAttachInfo(attachID, options).then((request) => request(this.axios, this.basePath)); } /** * - * @param {AttachAttachIDBody} body - * @param {string} attachID + * @summary 获取附件列表 + * @param {number} page 页码 + * @param {number} size 大小 * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AttachControllerApi */ - public async modifyAttach(body: AttachAttachIDBody, attachID: string, options?: AxiosRequestConfig) : Promise> { - return AttachControllerApiFp(this.configuration).modifyAttach(body, attachID, options).then((request) => request(this.axios, this.basePath)); + public async getAttachList(page: number, size: number, options?: AxiosRequestConfig) : Promise> { + return AttachControllerApiFp(this.configuration).getAttachList(page, size, options).then((request) => request(this.axios, this.basePath)); + } + /** + * + * @summary 更新附件 + * @param {number} attachID + * @param {AttachAttachIDBody} [body] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AttachControllerApi + */ + public async updateAttach(attachID: number, body?: AttachAttachIDBody, options?: AxiosRequestConfig) : Promise> { + return AttachControllerApiFp(this.configuration).updateAttach(attachID, body, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/blog-frontend/src/swagger/models/attach-attach-idbody.ts b/blog-frontend/src/swagger/models/attach-attach-idbody.ts index 121f096..cec709a 100644 --- a/blog-frontend/src/swagger/models/attach-attach-idbody.ts +++ b/blog-frontend/src/swagger/models/attach-attach-idbody.ts @@ -22,5 +22,5 @@ export interface AttachAttachIDBody { * @type {Blob} * @memberof AttachAttachIDBody */ - file?: Blob; + file: Blob; } diff --git a/blog-frontend/src/swagger/models/attach-info-response-vo.ts b/blog-frontend/src/swagger/models/attach-info-response-vo.ts index b157ca4..300aef4 100644 --- a/blog-frontend/src/swagger/models/attach-info-response-vo.ts +++ b/blog-frontend/src/swagger/models/attach-info-response-vo.ts @@ -11,6 +11,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ +import { UserInfoResponseVO } from './user-info-response-vo'; /** * * @export @@ -25,10 +26,16 @@ export interface AttachInfoResponseVO { id: number; /** * - * @type {string} + * @type {UserInfoResponseVO} * @memberof AttachInfoResponseVO */ - creator: string; + creator: UserInfoResponseVO; + /** + * + * @type {UserInfoResponseVO} + * @memberof AttachInfoResponseVO + */ + updater: UserInfoResponseVO; /** * * @type {Date} diff --git a/blog-frontend/src/swagger/models/blog-update-require-vo.ts b/blog-frontend/src/swagger/models/blog-update-require-vo.ts index fe21a54..b63be87 100644 --- a/blog-frontend/src/swagger/models/blog-update-require-vo.ts +++ b/blog-frontend/src/swagger/models/blog-update-require-vo.ts @@ -29,12 +29,6 @@ export interface BlogUpdateRequireVO { * @memberof BlogUpdateRequireVO */ abstracts?: string; - /** - * - * @type {string} - * @memberof BlogUpdateRequireVO - */ - password?: string; /** * * @type {string} diff --git a/blog-frontend/src/swagger/models/index.ts b/blog-frontend/src/swagger/models/index.ts index b5613a8..8076b37 100644 --- a/blog-frontend/src/swagger/models/index.ts +++ b/blog-frontend/src/swagger/models/index.ts @@ -6,6 +6,7 @@ export * from './pageable-voattach-info-response-vo'; export * from './pageable-voblog-info-response-vo'; export * from './pageable-vosetting-info-response-vo'; export * from './pageable-vouser-info-response-vo'; +export * from './response-voattach-info-response-vo'; export * from './response-voblog-info-response-vo'; export * from './response-volong'; export * from './response-vopageable-voattach-info-response-vo'; diff --git a/blog-frontend/src/swagger/models/response-voattach-info-response-vo.ts b/blog-frontend/src/swagger/models/response-voattach-info-response-vo.ts new file mode 100644 index 0000000..dedac43 --- /dev/null +++ b/blog-frontend/src/swagger/models/response-voattach-info-response-vo.ts @@ -0,0 +1,39 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI definition + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: v0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +import { AttachInfoResponseVO } from './attach-info-response-vo'; +/** + * + * @export + * @interface ResponseVOAttachInfoResponseVO + */ +export interface ResponseVOAttachInfoResponseVO { + /** + * + * @type {number} + * @memberof ResponseVOAttachInfoResponseVO + */ + code?: number; + /** + * + * @type {string} + * @memberof ResponseVOAttachInfoResponseVO + */ + msg?: string; + /** + * + * @type {AttachInfoResponseVO} + * @memberof ResponseVOAttachInfoResponseVO + */ + content?: AttachInfoResponseVO; +} diff --git a/blog-frontend/src/swagger/models/v1-attach-body.ts b/blog-frontend/src/swagger/models/v1-attach-body.ts index f9bcaae..17e813a 100644 --- a/blog-frontend/src/swagger/models/v1-attach-body.ts +++ b/blog-frontend/src/swagger/models/v1-attach-body.ts @@ -22,5 +22,5 @@ export interface V1AttachBody { * @type {Blob} * @memberof V1AttachBody */ - file?: Blob; + file: Blob; }