|
@@ -4,6 +4,7 @@ import { ReturnModelType } from '@typegoose/typegoose';
|
|
|
import { BaseService } from 'free-midway-component';
|
|
|
import { Project } from '../../entity/platform/project.entity';
|
|
|
import { Collection } from '../../entity/platform/collection.entity';
|
|
|
+import { get } from 'lodash';
|
|
|
type modelType = ReturnModelType<typeof Project>;
|
|
|
@Provide()
|
|
|
export class ProjectService extends BaseService<modelType> {
|
|
@@ -16,7 +17,7 @@ export class ProjectService extends BaseService<modelType> {
|
|
|
const user = this.ctx.user;
|
|
|
const data = { userInfo: {}, is_collection: false };
|
|
|
const arr = await this.model.findById(id).lean();
|
|
|
- if (arr) {
|
|
|
+ if (arr && get(arr, '_id')) {
|
|
|
|
|
|
const collection = await this.cModel.findOne({ user: user._id, source: arr._id }).lean();
|
|
|
if (collection) data.is_collection = true;
|