@shaxpir/duiduidui-models 1.6.13 → 1.6.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,10 @@ export declare enum FriendRequestStatus {
8
8
  ACCEPTED = "accepted",
9
9
  REJECTED = "rejected"
10
10
  }
11
+ export declare enum SharingLevel {
12
+ FRIEND = "friend",// Default sharing level - basic progress visibility
13
+ TEACHER = "teacher"
14
+ }
11
15
  export interface SocialUser {
12
16
  user_id: ContentId;
13
17
  username: string;
@@ -25,6 +29,8 @@ export interface FriendRequest {
25
29
  }
26
30
  export interface Friend extends SocialUser {
27
31
  since: CompactDateTime;
32
+ my_sharing_level: SharingLevel;
33
+ their_sharing_level: SharingLevel;
28
34
  }
29
35
  export interface BlockedUser extends SocialUser {
30
36
  blocked_at: CompactDateTime;
@@ -55,6 +61,8 @@ export declare class Social extends Content {
55
61
  addFriend(friend: Friend): void;
56
62
  removeFriend(userId: ContentId): void;
57
63
  isFriend(userId: ContentId): boolean;
64
+ updateMySharingLevel(userId: ContentId, sharingLevel: SharingLevel): void;
65
+ updateTheirSharingLevel(userId: ContentId, sharingLevel: SharingLevel): void;
58
66
  getBlockedUsers(): BlockedUser[];
59
67
  addBlockedUser(blockedUser: BlockedUser): void;
60
68
  removeBlockedUser(userId: ContentId): void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Social = exports.FriendRequestStatus = void 0;
3
+ exports.Social = exports.SharingLevel = exports.FriendRequestStatus = void 0;
4
4
  const shaxpir_common_1 = require("@shaxpir/shaxpir-common");
5
5
  const repo_1 = require("../repo");
6
6
  const Content_1 = require("./Content");
@@ -12,6 +12,11 @@ var FriendRequestStatus;
12
12
  FriendRequestStatus["ACCEPTED"] = "accepted";
13
13
  FriendRequestStatus["REJECTED"] = "rejected";
14
14
  })(FriendRequestStatus || (exports.FriendRequestStatus = FriendRequestStatus = {}));
15
+ var SharingLevel;
16
+ (function (SharingLevel) {
17
+ SharingLevel["FRIEND"] = "friend";
18
+ SharingLevel["TEACHER"] = "teacher"; // Enhanced sharing - detailed progress and learning insights
19
+ })(SharingLevel || (exports.SharingLevel = SharingLevel = {}));
15
20
  class Social extends Content_1.Content {
16
21
  static makeSocialId(userId) {
17
22
  return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.SOCIAL);
@@ -118,6 +123,24 @@ class Social extends Content_1.Content {
118
123
  this.checkDisposed("Social.isFriend");
119
124
  return this.payload.friends.some(f => f.user_id === userId);
120
125
  }
126
+ updateMySharingLevel(userId, sharingLevel) {
127
+ this.checkDisposed("Social.updateMySharingLevel");
128
+ const index = this.payload.friends.findIndex(f => f.user_id === userId);
129
+ if (index !== -1) {
130
+ const batch = new Operation_1.BatchOperation(this);
131
+ batch.setPathValue(['payload', 'friends', index, 'my_sharing_level'], sharingLevel);
132
+ batch.commit();
133
+ }
134
+ }
135
+ updateTheirSharingLevel(userId, sharingLevel) {
136
+ this.checkDisposed("Social.updateTheirSharingLevel");
137
+ const index = this.payload.friends.findIndex(f => f.user_id === userId);
138
+ if (index !== -1) {
139
+ const batch = new Operation_1.BatchOperation(this);
140
+ batch.setPathValue(['payload', 'friends', index, 'their_sharing_level'], sharingLevel);
141
+ batch.commit();
142
+ }
143
+ }
121
144
  // ========== Blocked Users ==========
122
145
  getBlockedUsers() {
123
146
  this.checkDisposed("Social.getBlockedUsers");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.6.13",
3
+ "version": "1.6.14",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"