TP-5555 | fix project reference id

This commit is contained in:
varnit goyal
2024-12-03 06:25:04 +05:30
parent 17a707633e
commit 1d99ef48f4

View File

@@ -35,6 +35,7 @@ type UpdateProjectBody struct {
Icon string `json:"logoUrl" binding:"required"`
GithubUrl string `json:"githubUrl" binding:"required"`
IgnorePatterns []string `json:"ignorePatterns" binding:"required"`
Account string `json:"account" binding:"required"`
}
func NewProjectCreator(logger *log.Logger, dbClient *gorm.DB, s3Client *aws.Actions, kafkaProducer producer.KProducer) *ProjectCreator {
@@ -138,10 +139,11 @@ func (pc *ProjectCreator) ProjectUpdate(c *gin.Context) {
}
// Update the project in the database
if result := pc.dbClient.Where("id = ?", projectId).Updates(&db.Project{
if result := pc.dbClient.Where("project_reference_id = ?", projectId).Updates(&db.Project{
GithubUrl: updateProjectBody.GithubUrl,
Icon: updateProjectBody.Icon,
IgnorePatterns: updateProjectBody.IgnorePatterns,
Account: updateProjectBody.Account,
}); result.Error != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": result.Error.Error()})
return