Skip to content

Commit 4ed6964

Browse files
v1.0.6: fix types
1 parent 46ca6c5 commit 4ed6964

19 files changed

Lines changed: 264 additions & 9 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ccw-api/api",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"description": "ccw api collections",
55
"license": "MIT",
66
"author": "Meng Fuzi",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { shareCreation } from "./creation_share";
2+
import { test, testAuthWriteApi } from "src/testUtils";
3+
4+
test("share creation to feed", async () => {
5+
await testAuthWriteApi(() => shareCreation("69740f1a61b891733d5ee2c6"));
6+
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { request } from "src/request";
2+
import { ApiResponse, MongoDBId } from "src/types/api";
3+
4+
export const url = "https://community-web.ccw.site/feed/creation_share";
5+
6+
export type Req = {
7+
creationOid: MongoDBId;
8+
};
9+
10+
export type Res = boolean;
11+
12+
/**
13+
* 分享作品到动态
14+
* @param {MongoDBId} creationOid 作品 OID
15+
* @returns {Promise<Res>} true 表示分享成功
16+
*/
17+
export async function shareCreation(creationOid: MongoDBId): Promise<Res> {
18+
const req: Req = { creationOid };
19+
return await request
20+
.post<ApiResponse<Res>>(url, req)
21+
.then((res) => res.data.body);
22+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { shareFriendInvite } from "./friend_invite";
2+
import { test, testAuthWriteApi } from "src/testUtils";
3+
4+
test("share friend invite to feed", async () => {
5+
await testAuthWriteApi(() => shareFriendInvite("description"));
6+
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { request } from "src/request";
2+
import { ApiResponse } from "src/types/api";
3+
4+
export const url = "https://community-web.ccw.site/feed/friend_invite";
5+
6+
export type Req = {
7+
message: string;
8+
};
9+
10+
export type Res = boolean;
11+
12+
/**
13+
* 在动态分享邀请消息
14+
* @param {string} message 分享消息内容
15+
* @returns {Promise<Res>} true 表示分享成功
16+
*/
17+
export async function shareFriendInvite(message: string): Promise<Res> {
18+
const req: Req = { message };
19+
return await request
20+
.post<ApiResponse<Res>>(url, req)
21+
.then((res) => res.data.body);
22+
}

src/community-web/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,18 @@ import { getPersonalCurrencyAccount } from "./currency/account/personal";
6262
import { getAllEmojis } from "./emoji/all";
6363
import { getEmojiCategoryList } from "./emoji/category/list";
6464
import { getEmojiPage } from "./emoji/page";
65+
import { resolveExternalIp } from "./study-main/external/ip/resolve";
66+
import { getDistrictList } from "./study-main/districts/list";
67+
import { getSchoolList } from "./study-main/schools/list";
68+
import { shareCreation } from "./feed/creation_share";
69+
import { shareFriendInvite } from "./feed/friend_invite";
6570
import { sendEvent } from "./event";
6671
import { getHealthCheck } from "./health/check";
6772
import { getLeafletsItemList } from "./leaflets/item/list";
6873
import { getLockedUserDetail } from "./locked_user/detail";
6974
import { getMutedUserDetail } from "./muted_user/detail";
75+
import { shareCreationToFriend } from "./notification/creation_share";
76+
import { recommendUser } from "./notification/user_recommend";
7077
import { getNotificationPage } from "./notification/page";
7178
import { getNotificationStats } from "./notification/stats/v2";
7279
import { getTypicalProjectPage } from "./typical_project/page";
@@ -152,6 +159,8 @@ export const communityWeb = {
152159
getCreationScreenshotPage,
153160
getCreationStudentDetail,
154161
getCreationTags,
162+
getDistrictList,
163+
getSchoolList,
155164
getCreatorScore,
156165
getDonatedRecordRanking,
157166
getExcellentCreations,
@@ -213,15 +222,20 @@ export const communityWeb = {
213222
getUserLabelList,
214223
getUserProductsPage,
215224
queryMallProducts,
225+
recommendUser,
216226
getCreationsByStudent,
217227
insertCheckInRecord,
218228
likeComment,
219229
produceTeamMemberTicket,
220230
resetCommentWeight,
231+
resolveExternalIp,
221232
searchCloudAssets,
222233
searchCreationsByTag,
223234
sendEvent,
224235
setUserProductStatus,
236+
shareCreation,
237+
shareCreationToFriend,
238+
shareFriendInvite,
225239
submitCreation,
226240
topComment,
227241
updateCreation,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { shareCreationToFriend } from "./creation_share";
2+
import { test, testAuthWriteApi } from "src/testUtils";
3+
4+
test("share creation to friend", async () => {
5+
await testAuthWriteApi(() =>
6+
shareCreationToFriend(
7+
"69740f1a61b891733d5ee2c6",
8+
"66bee08e19f4df62e807a694",
9+
),
10+
);
11+
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { request } from "src/request";
2+
import { ApiResponse, MongoDBId } from "src/types/api";
3+
4+
export const url = "https://community-web.ccw.site/notification/creation_share";
5+
6+
export type Req = {
7+
creationOid: MongoDBId;
8+
receiverOid: MongoDBId;
9+
};
10+
11+
export type Res = boolean;
12+
13+
/**
14+
* 分享作品给好友
15+
* @param {MongoDBId} creationOid 作品 OID
16+
* @param {MongoDBId} receiverOid 接收者 OID
17+
* @returns {Promise<Res>} true 表示分享成功
18+
*/
19+
export async function shareCreationToFriend(
20+
creationOid: MongoDBId,
21+
receiverOid: MongoDBId,
22+
): Promise<Res> {
23+
const req: Req = { creationOid, receiverOid };
24+
return await request
25+
.post<ApiResponse<Res>>(url, req)
26+
.then((res) => res.data.body);
27+
}

src/community-web/notification/page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export type Res = PagesRes<Notification>;
2020
* @returns {Promise<Res>} 分页通知数据
2121
*/
2222
export async function getNotificationPage<T extends string>(
23-
notifyGroup: NotificationGroup = NotificationGroup.CommentToMe,
23+
notifyGroup: NotificationGroup = "COMMENT_TO_ME",
2424
pageArgs_: Partial<PageArgs<"createdAt" | T>> = {
2525
sortField: "createdAt",
2626
},
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { recommendUser } from "./user_recommend";
2+
import { test, testAuthWriteApi } from "src/testUtils";
3+
4+
test("recommend user to friend", async () => {
5+
await testAuthWriteApi(() =>
6+
recommendUser(
7+
"65a90609a65f1229b0d6ab27",
8+
"63c2807d669fa967f17f5559",
9+
),
10+
);
11+
});

0 commit comments

Comments
 (0)