Skip to content

Commit 694a615

Browse files
authored
feat: subject collection score and comment (#746)
* build: upgrade to v0.20.7 * feat: add column 'comment' and 'score' in table 'subject_collection' and add dml for flyway migration sql. * feat: add SubjectCollectionRepositoryTest * feat: 条目收藏分数后台接口 * build: gen new api-client v20.7.0 * optimize: 分数范围配置为0到10 * feat: console条目详情页SubjectDetails.vue完成条目收藏中评分和评论的对接 * docs: update CHANGELOG.MD * test: disable unit test in SubjectCollectionServiceTest
1 parent f340701 commit 694a615

File tree

57 files changed

+853
-467
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+853
-467
lines changed

CHANGELOG.MD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
更新日志文档,版本顺序从新到旧,最新版本在最前(上)面。
44

5+
# 0.20.7
6+
7+
## 新特性
8+
9+
- 新增Console条目收藏的评分和评论支持
10+
511
# 0.20.6
612

713
## 新特性

api/src/main/java/run/ikaros/api/core/collection/SubjectCollection.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,9 @@ public class SubjectCollection {
5151
private String cover;
5252
@JsonProperty("air_time")
5353
private LocalDateTime airTime;
54+
private String comment;
55+
/**
56+
* Subject score, from 0 to 10.
57+
*/
58+
private Integer score;
5459
}

api/src/main/java/run/ikaros/api/infra/utils/StringUtils.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,15 @@ public static String generateRandomStr(int length) {
6969
return sb.toString();
7070
}
7171

72+
/**
73+
* 判断是否经过Base64编码.
74+
*
75+
* @param str 字符串
76+
* @return 是否
77+
*/
78+
public static boolean isBase64Encoded(String str) {
79+
// 判断字符串是否符合Base64编码规则
80+
String regex = "^[A-Za-z0-9+/=]+$";
81+
return str.matches(regex) && str.length() % 4 == 0;
82+
}
7283
}

console/packages/api-client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ npm publish
5858
选择当前目录下的更改进行`git add .`
5959

6060
```bash
61-
git commit -am "build: gen new api-client v20.6.0"
61+
git commit -am "build: gen new api-client v20.7.0"
6262
```
6363

6464
合成版(powershell),升级 package.json 版本,并启动服务端后,在 api-client 路径下:

console/packages/api-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@runikaros/api-client",
3-
"version": "20.6.0",
3+
"version": "20.7.0",
44
"description": "Project ikaros console api-client package",
55
"type": "module",
66
"scripts": {

console/packages/api-client/src/api/v1alpha1-collection-subject-api.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,17 @@ export const V1alpha1CollectionSubjectApiAxiosParamCreator = function (
5454
* @param {number} subjectId Subject id.
5555
* @param {'WISH' | 'DOING' | 'DONE' | 'SHELVE' | 'DISCARD'} type Collection type.
5656
* @param {boolean} [isPrivate] Is private, default is false.
57+
* @param {string} [comment] Subject comment, with base64 encoded.
58+
* @param {number} [score] Subject score, from 0 to 100.
5759
* @param {*} [options] Override http request option.
5860
* @throws {RequiredError}
5961
*/
6062
collectSubject: async (
6163
subjectId: number,
6264
type: "WISH" | "DOING" | "DONE" | "SHELVE" | "DISCARD",
6365
isPrivate?: boolean,
66+
comment?: string,
67+
score?: number,
6468
options: AxiosRequestConfig = {}
6569
): Promise<RequestArgs> => {
6670
// verify required parameter 'subjectId' is not null or undefined
@@ -103,6 +107,14 @@ export const V1alpha1CollectionSubjectApiAxiosParamCreator = function (
103107
localVarQueryParameter["isPrivate"] = isPrivate;
104108
}
105109

110+
if (comment !== undefined) {
111+
localVarQueryParameter["comment"] = comment;
112+
}
113+
114+
if (score !== undefined) {
115+
localVarQueryParameter["score"] = score;
116+
}
117+
106118
setSearchParams(localVarUrlObj, localVarQueryParameter);
107119
let headersFromBaseOptions =
108120
baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -378,13 +390,17 @@ export const V1alpha1CollectionSubjectApiFp = function (
378390
* @param {number} subjectId Subject id.
379391
* @param {'WISH' | 'DOING' | 'DONE' | 'SHELVE' | 'DISCARD'} type Collection type.
380392
* @param {boolean} [isPrivate] Is private, default is false.
393+
* @param {string} [comment] Subject comment, with base64 encoded.
394+
* @param {number} [score] Subject score, from 0 to 100.
381395
* @param {*} [options] Override http request option.
382396
* @throws {RequiredError}
383397
*/
384398
async collectSubject(
385399
subjectId: number,
386400
type: "WISH" | "DOING" | "DONE" | "SHELVE" | "DISCARD",
387401
isPrivate?: boolean,
402+
comment?: string,
403+
score?: number,
388404
options?: AxiosRequestConfig
389405
): Promise<
390406
(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>
@@ -393,6 +409,8 @@ export const V1alpha1CollectionSubjectApiFp = function (
393409
subjectId,
394410
type,
395411
isPrivate,
412+
comment,
413+
score,
396414
options
397415
);
398416
return createRequestFunction(
@@ -542,6 +560,8 @@ export const V1alpha1CollectionSubjectApiFactory = function (
542560
requestParameters.subjectId,
543561
requestParameters.type,
544562
requestParameters.isPrivate,
563+
requestParameters.comment,
564+
requestParameters.score,
545565
options
546566
)
547567
.then((request) => request(axios, basePath));
@@ -641,6 +661,20 @@ export interface V1alpha1CollectionSubjectApiCollectSubjectRequest {
641661
* @memberof V1alpha1CollectionSubjectApiCollectSubject
642662
*/
643663
readonly isPrivate?: boolean;
664+
665+
/**
666+
* Subject comment, with base64 encoded.
667+
* @type {string}
668+
* @memberof V1alpha1CollectionSubjectApiCollectSubject
669+
*/
670+
readonly comment?: string;
671+
672+
/**
673+
* Subject score, from 0 to 100.
674+
* @type {number}
675+
* @memberof V1alpha1CollectionSubjectApiCollectSubject
676+
*/
677+
readonly score?: number;
644678
}
645679

646680
/**
@@ -750,6 +784,8 @@ export class V1alpha1CollectionSubjectApi extends BaseAPI {
750784
requestParameters.subjectId,
751785
requestParameters.type,
752786
requestParameters.isPrivate,
787+
requestParameters.comment,
788+
requestParameters.score,
753789
options
754790
)
755791
.then((request) => request(this.axios, this.basePath));

console/packages/api-client/src/api/v1alpha1-indices-api.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,16 @@ export const V1alpha1IndicesApiAxiosParamCreator = function (
9797
* Search subjects with fuzzy query
9898
* @param {string} keyword
9999
* @param {number} [limit]
100-
* @param {string} [highlightPreTag]
101100
* @param {string} [highlightPostTag]
101+
* @param {string} [highlightPreTag]
102102
* @param {*} [options] Override http request option.
103103
* @throws {RequiredError}
104104
*/
105105
searchSubject: async (
106106
keyword: string,
107107
limit?: number,
108-
highlightPreTag?: string,
109108
highlightPostTag?: string,
109+
highlightPreTag?: string,
110110
options: AxiosRequestConfig = {}
111111
): Promise<RequestArgs> => {
112112
// verify required parameter 'keyword' is not null or undefined
@@ -139,16 +139,16 @@ export const V1alpha1IndicesApiAxiosParamCreator = function (
139139
localVarQueryParameter["limit"] = limit;
140140
}
141141

142-
if (keyword !== undefined) {
143-
localVarQueryParameter["keyword"] = keyword;
142+
if (highlightPostTag !== undefined) {
143+
localVarQueryParameter["highlightPostTag"] = highlightPostTag;
144144
}
145145

146146
if (highlightPreTag !== undefined) {
147147
localVarQueryParameter["highlightPreTag"] = highlightPreTag;
148148
}
149149

150-
if (highlightPostTag !== undefined) {
151-
localVarQueryParameter["highlightPostTag"] = highlightPostTag;
150+
if (keyword !== undefined) {
151+
localVarQueryParameter["keyword"] = keyword;
152152
}
153153

154154
setSearchParams(localVarUrlObj, localVarQueryParameter);
@@ -199,25 +199,25 @@ export const V1alpha1IndicesApiFp = function (configuration?: Configuration) {
199199
* Search subjects with fuzzy query
200200
* @param {string} keyword
201201
* @param {number} [limit]
202-
* @param {string} [highlightPreTag]
203202
* @param {string} [highlightPostTag]
203+
* @param {string} [highlightPreTag]
204204
* @param {*} [options] Override http request option.
205205
* @throws {RequiredError}
206206
*/
207207
async searchSubject(
208208
keyword: string,
209209
limit?: number,
210-
highlightPreTag?: string,
211210
highlightPostTag?: string,
211+
highlightPreTag?: string,
212212
options?: AxiosRequestConfig
213213
): Promise<
214214
(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SubjectHints>
215215
> {
216216
const localVarAxiosArgs = await localVarAxiosParamCreator.searchSubject(
217217
keyword,
218218
limit,
219-
highlightPreTag,
220219
highlightPostTag,
220+
highlightPreTag,
221221
options
222222
);
223223
return createRequestFunction(
@@ -265,8 +265,8 @@ export const V1alpha1IndicesApiFactory = function (
265265
.searchSubject(
266266
requestParameters.keyword,
267267
requestParameters.limit,
268-
requestParameters.highlightPreTag,
269268
requestParameters.highlightPostTag,
269+
requestParameters.highlightPreTag,
270270
options
271271
)
272272
.then((request) => request(axios, basePath));
@@ -299,14 +299,14 @@ export interface V1alpha1IndicesApiSearchSubjectRequest {
299299
* @type {string}
300300
* @memberof V1alpha1IndicesApiSearchSubject
301301
*/
302-
readonly highlightPreTag?: string;
302+
readonly highlightPostTag?: string;
303303

304304
/**
305305
*
306306
* @type {string}
307307
* @memberof V1alpha1IndicesApiSearchSubject
308308
*/
309-
readonly highlightPostTag?: string;
309+
readonly highlightPreTag?: string;
310310
}
311311

312312
/**
@@ -343,8 +343,8 @@ export class V1alpha1IndicesApi extends BaseAPI {
343343
.searchSubject(
344344
requestParameters.keyword,
345345
requestParameters.limit,
346-
requestParameters.highlightPreTag,
347346
requestParameters.highlightPostTag,
347+
requestParameters.highlightPreTag,
348348
options
349349
)
350350
.then((request) => request(this.axios, this.basePath));

console/packages/api-client/src/models/paging-wrap.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ export interface PagingWrap {
4343
*/
4444
items: Array<object>;
4545
/**
46-
* Indicates whether current page is the last page.
46+
* Indicates whether current page is the first page.
4747
* @type {boolean}
4848
* @memberof PagingWrap
4949
*/
50-
lastPage: boolean;
50+
firstPage: boolean;
5151
/**
52-
* Indicates whether current page is the first page.
52+
* Indicates whether current page is the last page.
5353
* @type {boolean}
5454
* @memberof PagingWrap
5555
*/
56-
firstPage: boolean;
56+
lastPage: boolean;
5757
/**
5858
* Indicates whether current page has previous page.
5959
* @type {boolean}

console/packages/api-client/src/models/subject-collection.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ export interface SubjectCollection {
6060
* @memberof SubjectCollection
6161
*/
6262
cover?: string;
63+
/**
64+
*
65+
* @type {string}
66+
* @memberof SubjectCollection
67+
*/
68+
comment?: string;
69+
/**
70+
*
71+
* @type {number}
72+
* @memberof SubjectCollection
73+
*/
74+
score?: number;
6375
/**
6476
*
6577
* @type {number}

console/src/components/image/Cropperjs.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import Cropper from 'cropperjs';
33
import 'cropperjs/dist/cropper.css';
4-
import {onMounted, ref, watch} from 'vue';
4+
import { onMounted, ref, watch } from 'vue';
55
66
const props = withDefaults(
77
defineProps<{

console/src/components/image/CropperjsDialog.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script setup lang="ts">
2-
import {computed, ref} from 'vue';
2+
import { computed, ref } from 'vue';
33
import Cropperjs from './Cropperjs.vue';
4-
import {ElButton, ElDialog} from 'element-plus';
5-
import {apiClient} from '@/utils/api-client';
6-
import {randomUUID} from '@/utils/id';
4+
import { ElButton, ElDialog } from 'element-plus';
5+
import { apiClient } from '@/utils/api-client';
6+
import { randomUUID } from '@/utils/id';
77
88
const props = withDefaults(
99
defineProps<{

console/src/components/modules/content/subject/SubjectCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
2-
import {ElCard, ElProgress} from 'element-plus';
3-
import {computed, onMounted, ref, watch} from 'vue';
2+
import { ElCard, ElProgress } from 'element-plus';
3+
import { computed, onMounted, ref, watch } from 'vue';
44
55
const props = withDefaults(
66
defineProps<{

0 commit comments

Comments
 (0)