1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| 'use strict';
module.exports = app => { const { STRING, DATE } = app.Sequelize;
const Project = app.model.define('project', { app_id: { type: STRING, primaryKey: true, }, app_name: STRING(30), jenkins_name: STRING, map_source: STRING, git_url: STRING, created_at: DATE, updated_at: DATE, }); //增 Project.createByAppId = async function({ appId, appName, jenkinsName, mapSource, gitUrl }) { return await this.create({ app_id: appId, app_name: appName, jenkins_name: jenkinsName, map_source: mapSource, git_url: gitUrl, }); }; //查 Project.findByAppId = async function(appid) { return await this.findOne({ where: { appid, }, }); };
// 改 Project.prototype.logSignin = async function() { return await this.update({ last_sign_in_at: new Date() }); };
return Project; };
|