m
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DailyMeetingStatsService = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const typeorm_1 = require("@nestjs/typeorm");
|
||||
const typeorm_2 = require("typeorm");
|
||||
const daily_meeting_stats_model_1 = require("../../../model/daily_meeting_stats.model");
|
||||
const api_1 = require("../../common/api");
|
||||
const help_1 = require("../../common/util/help");
|
||||
const app_info_context_1 = require("../context/app_info.context");
|
||||
let DailyMeetingStatsService = class DailyMeetingStatsService {
|
||||
dailyMeetingStatsModel;
|
||||
constructor(dailyMeetingStatsModel) {
|
||||
this.dailyMeetingStatsModel = dailyMeetingStatsModel;
|
||||
}
|
||||
async recordMeeting() {
|
||||
const device = app_info_context_1.AppInfoContext.getAppInfo().device;
|
||||
const today = help_1.Help.formatDate(Date.now(), 'YYYY-MM-DD');
|
||||
const existing = await this.dailyMeetingStatsModel.findOne({
|
||||
where: { device, date: today },
|
||||
});
|
||||
if (existing) {
|
||||
return api_1.Api.success();
|
||||
}
|
||||
try {
|
||||
const record = this.dailyMeetingStatsModel.create({
|
||||
device,
|
||||
date: today,
|
||||
});
|
||||
await this.dailyMeetingStatsModel.save(record);
|
||||
}
|
||||
catch {
|
||||
}
|
||||
return api_1.Api.success();
|
||||
}
|
||||
};
|
||||
exports.DailyMeetingStatsService = DailyMeetingStatsService;
|
||||
exports.DailyMeetingStatsService = DailyMeetingStatsService = __decorate([
|
||||
(0, common_1.Injectable)(),
|
||||
__param(0, (0, typeorm_1.InjectRepository)(daily_meeting_stats_model_1.DailyMeetingStatsModel)),
|
||||
__metadata("design:paramtypes", [typeorm_2.Repository])
|
||||
], DailyMeetingStatsService);
|
||||
//# sourceMappingURL=daily_meeting_stats.service.js.map
|
||||
Reference in New Issue
Block a user