onecore 0.5.9 → 0.5.11

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.
package/lib/index.js CHANGED
@@ -142,3 +142,18 @@ var SavedService = (function () {
142
142
  }());
143
143
  exports.SavedService = SavedService;
144
144
  exports.SavedUseCase = SavedService;
145
+ var FollowService = (function () {
146
+ function FollowService(followRepository) {
147
+ this.followRepository = followRepository;
148
+ this.follow = this.follow.bind(this);
149
+ this.unfollow = this.unfollow.bind(this);
150
+ }
151
+ FollowService.prototype.follow = function (id, target) {
152
+ return this.followRepository.follow(id, target);
153
+ };
154
+ FollowService.prototype.unfollow = function (id, target) {
155
+ return this.followRepository.unfollow(id, target);
156
+ };
157
+ return FollowService;
158
+ }());
159
+ exports.FollowService = FollowService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onecore",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
4
4
  "description": "onecore",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
package/src/index.ts CHANGED
@@ -253,3 +253,20 @@ export class SavedService<UID, ID> {
253
253
  }
254
254
  }
255
255
  export const SavedUseCase = SavedService
256
+
257
+ export interface FollowRepository<ID> {
258
+ follow(id: ID, target: ID): Promise<number>
259
+ unfollow(id: ID, target: ID): Promise<number>
260
+ }
261
+ export class FollowService<ID> {
262
+ constructor(protected followRepository: FollowRepository<ID>) {
263
+ this.follow = this.follow.bind(this)
264
+ this.unfollow = this.unfollow.bind(this)
265
+ }
266
+ follow(id: ID, target: ID): Promise<number> {
267
+ return this.followRepository.follow(id, target)
268
+ }
269
+ unfollow(id: ID, target: ID): Promise<number> {
270
+ return this.followRepository.unfollow(id, target)
271
+ }
272
+ }
package/src/model.ts CHANGED
@@ -44,14 +44,17 @@ export interface Domain {
44
44
  status?: string;
45
45
  }
46
46
  export interface Item {
47
+ id?: string;
47
48
  value: string;
48
49
  text?: string;
49
50
  }
50
51
  export interface ValueText {
52
+ id?: string;
51
53
  value: string;
52
54
  text?: string;
53
55
  }
54
56
  export interface ValueCode {
57
+ id?: string;
55
58
  value: string;
56
59
  code?: string;
57
60
  }