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

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

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

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

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

5
script/0.0.3/2.alter_table_project_correlation.sql

@ -6,4 +6,7 @@ alter table project_correlation
alter table project_correlation
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