You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2024/05/10 03:27:45 UTC
(incubator-devlake) branch post-project-bp updated: fix: post project with blueprint
This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch post-project-bp
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/post-project-bp by this push:
new 9f7c83ba2 fix: post project with blueprint
9f7c83ba2 is described below
commit 9f7c83ba2796c9d740c0a0d7b34ed1551df08ad2
Author: abeizn <zi...@merico.dev>
AuthorDate: Fri May 10 11:27:32 2024 +0800
fix: post project with blueprint
---
backend/core/models/project.go | 1 +
backend/server/services/project.go | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/backend/core/models/project.go b/backend/core/models/project.go
index 5014f20b3..56cd3b500 100644
--- a/backend/core/models/project.go
+++ b/backend/core/models/project.go
@@ -62,6 +62,7 @@ type ApiInputProject struct {
BaseProject `mapstructure:",squash"`
Enable *bool `json:"enable" mapstructure:"enable"`
Metrics []*BaseMetric `json:"metrics" mapstructure:"metrics"`
+ Blueprint *Blueprint `json:"blueprint" mapstructure:"blueprint"`
}
type ApiOutputProject struct {
diff --git a/backend/server/services/project.go b/backend/server/services/project.go
index 51d773e82..4bc1d5280 100644
--- a/backend/server/services/project.go
+++ b/backend/server/services/project.go
@@ -108,6 +108,14 @@ func CreateProject(projectInput *models.ApiInputProject) (*models.ApiOutputProje
}
}
+ // create blueprint
+ if projectInput.Blueprint != nil {
+ err = CreateBlueprint(projectInput.Blueprint)
+ if err != nil {
+ return nil, err
+ }
+ }
+
// all good, commit transaction
err = tx.Commit()
if err != nil {