onecore 0.5.11 → 0.5.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.
package/lib/index.js CHANGED
@@ -113,47 +113,3 @@ exports.GenericUseCase = GenericUseCase;
113
113
  exports.CRUDUseCase = GenericUseCase;
114
114
  exports.GenericManager = GenericUseCase;
115
115
  exports.CRUDManager = GenericUseCase;
116
- var SavedService = (function () {
117
- function SavedService(savedRepository, max) {
118
- this.savedRepository = savedRepository;
119
- this.max = max;
120
- this.isSaved = this.isSaved.bind(this);
121
- this.save = this.save.bind(this);
122
- this.remove = this.remove.bind(this);
123
- }
124
- SavedService.prototype.isSaved = function (userId, id) {
125
- return this.savedRepository.isSaved(userId, id);
126
- };
127
- SavedService.prototype.save = function (userId, id) {
128
- var _this = this;
129
- return this.savedRepository.count(userId).then(function (count) {
130
- if (count >= _this.max) {
131
- return -1;
132
- }
133
- else {
134
- return _this.savedRepository.save(userId, id);
135
- }
136
- });
137
- };
138
- SavedService.prototype.remove = function (userId, id) {
139
- return this.savedRepository.remove(userId, id);
140
- };
141
- return SavedService;
142
- }());
143
- exports.SavedService = SavedService;
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.11",
3
+ "version": "0.5.14",
4
4
  "description": "onecore",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
package/src/index.ts CHANGED
@@ -221,52 +221,3 @@ export class GenericUseCase<T, ID> extends Writer<T> implements GenericService<T
221
221
  export const CRUDUseCase = GenericUseCase
222
222
  export const GenericManager = GenericUseCase
223
223
  export const CRUDManager = GenericUseCase
224
-
225
- export interface SavedRepository<UID, ID> {
226
- isSaved(userId: UID, id: ID): Promise<boolean>
227
- save(userId: UID, id: ID): Promise<number>
228
- remove(userId: UID, id: ID): Promise<number>
229
- count(userId: UID): Promise<number>
230
- }
231
-
232
- // tslint:disable-next-line:max-classes-per-file
233
- export class SavedService<UID, ID> {
234
- constructor(protected savedRepository: SavedRepository<UID, ID>, protected max: number) {
235
- this.isSaved = this.isSaved.bind(this);
236
- this.save = this.save.bind(this);
237
- this.remove = this.remove.bind(this);
238
- }
239
- isSaved(userId: UID, id: ID): Promise<boolean> {
240
- return this.savedRepository.isSaved(userId, id)
241
- }
242
- save(userId: UID, id: ID): Promise<number> {
243
- return this.savedRepository.count(userId).then((count) => {
244
- if (count >= this.max) {
245
- return -1
246
- } else {
247
- return this.savedRepository.save(userId, id)
248
- }
249
- })
250
- }
251
- remove(userId: UID, id: ID): Promise<number> {
252
- return this.savedRepository.remove(userId, id)
253
- }
254
- }
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/location.ts CHANGED
@@ -1,13 +1,18 @@
1
1
  import {DateRange, Filter, NumberRange} from './model';
2
2
 
3
3
  export interface Article {
4
- id?: string;
5
- title?: string;
6
- type?: string;
7
- description?: string;
8
- content?: string;
9
- tags?: string[];
10
- status?: string;
4
+ id: string
5
+ slug: string
6
+ title: string
7
+ description?: string
8
+ content?: string
9
+ publishedAt?: Date
10
+ tags?: string[]
11
+ thumbnail?: string
12
+ status?: string
13
+ createdAt?: Date
14
+ authorId?: string
15
+ savedAt?: Date
11
16
  }
12
17
  export interface ArticleFilter extends Filter {
13
18
  id?: string;
package/src/model.ts CHANGED
@@ -47,6 +47,7 @@ export interface Item {
47
47
  id?: string;
48
48
  value: string;
49
49
  text?: string;
50
+ fulltext?: string;
50
51
  }
51
52
  export interface ValueText {
52
53
  id?: string;
@@ -254,3 +255,37 @@ export interface Info10 {
254
255
  export interface InfoRepository<ID> {
255
256
  exist(id: ID, ctx?: any): Promise<boolean>;
256
257
  }
258
+
259
+ export interface Company {
260
+ id: string
261
+ slug: string
262
+ name: string
263
+ overview: string
264
+ website?: string
265
+ industry?: string
266
+ size?: string
267
+ logo?: string
268
+ coverURL?: string
269
+ status: string
270
+
271
+ followerCount?: number
272
+ followingAt?: Date
273
+ followedAt?: Date
274
+ }
275
+ export interface Job {
276
+ id: string
277
+ slug: string
278
+ title: string
279
+ description: string
280
+ publishedAt?: Date
281
+ expiredAt?: Date
282
+ position?: string
283
+ quantity?: number
284
+ location?: string
285
+ applicantCount?: number
286
+ skills?: string[]
287
+ minSalary?: number
288
+ maxSalary?: number
289
+ companyId?: string
290
+ status: string
291
+ }