Browse Source

删除绑定关系

dev
巴林闲侠 3 years ago
parent
commit
89a5d9a28a
  1. 5
      api/app/lib/controllers/project/bind.js
  2. 1
      api/app/lib/controllers/project/index.js
  3. 11
      api/app/lib/models/project_correlation.js
  4. 3
      script/0.0.3/2.alter_table_project_correlation.sql

5
api/app/lib/controllers/project/bind.js

@ -59,6 +59,7 @@ async function bindAnxin2pep (ctx) {
let storageData = { let storageData = {
name, pepProjectId, anxinProjectId, name, pepProjectId, anxinProjectId,
updateTime: now,
del: false, del: false,
} }
@ -129,7 +130,7 @@ async function bindAnxin2pep (ctx) {
async function del (ctx) { async function del (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { bindId } = ctx.query const { bindId } = ctx.params
await models.ProjectCorrelation.update({ await models.ProjectCorrelation.update({
del: true del: true
@ -139,7 +140,7 @@ async function del (ctx) {
} }
}) })
ctx.status = 20; ctx.status = 204;
} catch (error) { } catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: error`); ctx.fs.logger.error(`path: ${ctx.path}, error: error`);
ctx.status = 400; ctx.status = 400;

1
api/app/lib/controllers/project/index.js

@ -29,6 +29,7 @@ async function pomsProject (ctx) {
where: { where: {
del: false del: false
}, },
order: [['updateTime', 'desc']],
distinct: true, distinct: true,
include: { include: {
model: models.App, model: models.App,

11
api/app/lib/models/project_correlation.js

@ -68,7 +68,16 @@ module.exports = dc => {
primaryKey: false, primaryKey: false,
field: "del", field: "del",
autoIncrement: false autoIncrement: false
} },
updateTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "update_time",
autoIncrement: false
},
}, { }, {
tableName: "project_correlation", tableName: "project_correlation",
comment: "", comment: "",

3
script/0.0.3/2.alter_table_project_correlation.sql

@ -7,3 +7,6 @@ alter table project_correlation
add del bool default false; add del bool default false;
alter table project_correlation alter column pep_project_id drop not null; alter table project_correlation alter column pep_project_id drop not null;
alter table project_correlation
add update_time timestamp with time zone;
Loading…
Cancel
Save