building.js 569 Bytes
'use strict';

const Model = require('./model');

class Building extends Model {

    constructor() {
        super('buildings');
    }

    async updateState(id, state) {
        await this.update({
            _id: id
        }, {
            $set: {
                state: state,
                updatedAt: new Date()
            }
        });
    }

    async updateMd5(id, md5) {
        await this.update({_id: id}, {
            $set: {
                md5: md5,
                updatedAt: new Date()
            }
        });
    }
}

module.exports = Building;