修改一些字段

This commit is contained in:
luying
2021-01-19 11:23:04 +08:00
parent 3c35852495
commit 71c5182926
3 changed files with 13 additions and 10 deletions

View File

@@ -63,9 +63,9 @@ export class GuildHandler {
name: "name", name: "name",
icon: 1, icon: 1,
lv: 0, lv: 0,
peopleNum: 0, memberCnt: 0,
leader: "leader", leader: "leader",
ceCondition: 0, ceLimit: 0,
quitTime: 0, quitTime: 0,
hasApply: true hasApply: true
}]; }];

View File

@@ -71,11 +71,11 @@ describe('军团测试', function() {
expect(res.data).to.have.deep.property('rank').that.is.an('number'); expect(res.data).to.have.deep.property('rank').that.is.an('number');
expect(res.data).to.have.deep.property('lv').that.is.an('number'); expect(res.data).to.have.deep.property('lv').that.is.an('number');
expect(res.data).to.have.deep.property('fund').that.is.an('number'); expect(res.data).to.have.deep.property('fund').that.is.an('number');
expect(res.data).to.have.deep.property('peopleNum').that.is.an('number'); expect(res.data).to.have.deep.property('memberCnt').that.is.an('number');
expect(res.data).to.have.deep.property('manageNum').that.is.an('number'); expect(res.data).to.have.deep.property('managerCnt').that.is.an('number');
expect(res.data).to.have.deep.property('activeDaily').that.is.an('number'); expect(res.data).to.have.deep.property('activeDaily').that.is.an('number');
expect(res.data).to.have.deep.property('activeWeekly').that.is.an('number'); expect(res.data).to.have.deep.property('activeWeekly').that.is.an('number');
expect(res.data).to.have.deep.property('ceCondition').that.is.an('number'); expect(res.data).to.have.deep.property('ceLimit').that.is.an('number');
expect(res.data).to.have.deep.property('isAuto').that.is.an('boolean'); expect(res.data).to.have.deep.property('isAuto').that.is.an('boolean');
expect(res.data).to.have.deep.property('leader').that.is.an('object'); expect(res.data).to.have.deep.property('leader').that.is.an('object');
@@ -116,7 +116,7 @@ describe('军团测试', function() {
expect(list).to.have.deep.property('lv').that.is.a('number'); expect(list).to.have.deep.property('lv').that.is.a('number');
expect(list).to.have.deep.property('peopleNum').that.is.a('number'); expect(list).to.have.deep.property('peopleNum').that.is.a('number');
expect(list).to.have.deep.property('leader').that.is.a('string'); expect(list).to.have.deep.property('leader').that.is.a('string');
expect(list).to.have.deep.property('ceCondition').that.is.a('number'); expect(list).to.have.deep.property('ceLimit').that.is.a('number');
expect(list).to.have.deep.property('quitTime').that.is.a('number'); expect(list).to.have.deep.property('quitTime').that.is.a('number');
expect(list).to.have.deep.property('hasApply').that.is.a('boolean'); expect(list).to.have.deep.property('hasApply').that.is.a('boolean');
}); });

View File

@@ -26,8 +26,11 @@ export default class Guild extends BaseModel {
@prop({ required: true, default: 1 }) @prop({ required: true, default: 1 })
lv: number; lv: number;
@prop({ required: true, default: 0 }) @prop({ required: true, default: 1 })
peopleNum: number; memberCnt: number;
@prop({ required: true, default: 1 })
managerCnt: number;
@prop({ required: true }) @prop({ required: true })
leader: Ref<Role>; leader: Ref<Role>;
@@ -36,7 +39,7 @@ export default class Guild extends BaseModel {
isAuto: boolean; isAuto: boolean;
@prop({ required: true, default: 0 }) @prop({ required: true, default: 0 })
ceCondition: number; ceLimit: number;
@prop({ required: true, default: '' }) @prop({ required: true, default: '' })
notice: string; notice: string;
@@ -74,7 +77,7 @@ export default class Guild extends BaseModel {
delete update._id; delete update._id;
const code = genCode(6); const code = genCode(6);
const result: GuildType = await GuildModel.findOneAndUpdate({ code }, update, { upsert: true, new: true }) const result: GuildType = await GuildModel.findOneAndUpdate({ code }, update, { upsert: true, new: true })
.select('code name icon notice introduce lv fund peopleNum manageNum activeDaily activeWeekly ceCondition isAuto leader structure') .select('code name icon notice introduce lv fund memberCnt managerCnt activeDaily activeWeekly ceLimit isAuto leader structure')
.populate('leader', 'name sHid headHid lv updatedAt', 'Role') .populate('leader', 'name sHid headHid lv updatedAt', 'Role')
.lean(); .lean();