d4x1 commented on code in PR #8334:
URL: 
https://github.com/apache/incubator-devlake/pull/8334#discussion_r2573624312


##########
models/tag.go:
##########
@@ -0,0 +1,24 @@
+package models
+
+import (
+       "github.com/apache/incubator-devlake/core/models/common"
+)
+
+// Tag represents a tag that can be assigned to projects
+type Tag struct {
+       common.DynamicMapBase

Review Comment:
   I cannot find the definition of `DynamicMapBase` in common package.



##########
config/migration/migrationscripts/20230901_add_tags.go:
##########
@@ -0,0 +1,52 @@
+package migrationscripts

Review Comment:
   Please write migration scripts like this 
   
https://github.com/apache/incubator-devlake/blob/main/backend/core/models/migrationscripts/20251022_fix_null_priority.go
   
https://github.com/apache/incubator-devlake/blob/main/backend/core/models/migrationscripts/register.go#L25



##########
models/tag.go:
##########
@@ -0,0 +1,24 @@
+package models
+
+import (
+       "github.com/apache/incubator-devlake/core/models/common"
+)
+
+// Tag represents a tag that can be assigned to projects
+type Tag struct {
+       common.DynamicMapBase
+       Name        string `json:"name" gorm:"type:varchar(255);uniqueIndex"`
+       Description string `json:"description" gorm:"type:varchar(255)"`
+       Color       string `json:"color" gorm:"type:varchar(50)"`
+}
+
+// ProjectTag represents the many-to-many relationship between projects and 
tags
+type ProjectTag struct {
+       ProjectId string `json:"projectId" gorm:"primaryKey;type:varchar(255)"`

Review Comment:
   `Project` in package common doesn't have `ProjectId` field, I think it 
should be `ProjectName` here.



##########
models/tag.go:
##########
@@ -0,0 +1,24 @@
+package models
+
+import (
+       "github.com/apache/incubator-devlake/core/models/common"
+)
+
+// Tag represents a tag that can be assigned to projects
+type Tag struct {
+       common.DynamicMapBase
+       Name        string `json:"name" gorm:"type:varchar(255);uniqueIndex"`
+       Description string `json:"description" gorm:"type:varchar(255)"`
+       Color       string `json:"color" gorm:"type:varchar(50)"`
+}
+
+// ProjectTag represents the many-to-many relationship between projects and 
tags
+type ProjectTag struct {
+       ProjectId string `json:"projectId" gorm:"primaryKey;type:varchar(255)"`
+       TagId     string `json:"tagId" gorm:"primaryKey;type:varchar(255)"`

Review Comment:
   Since `Tag.Name` has an unique index, we can use `TagName` here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to