Compare commits
2 Commits
c20b9143db
...
8158fff075
Author | SHA1 | Date | |
---|---|---|---|
8158fff075 | |||
83fdd336a3 |
@ -188,7 +188,10 @@ func CreateTagAlias(ctx context.Context, db *gorm.DB, tagAliasName models.Anthro
|
|||||||
return &otterError.EntityValidationFailed{Reason: otterError.AnthroveTagIDEmpty}
|
return &otterError.EntityValidationFailed{Reason: otterError.AnthroveTagIDEmpty}
|
||||||
}
|
}
|
||||||
|
|
||||||
result := db.WithContext(ctx).Create(&models.TagAlias{
|
result := db.WithContext(ctx).Clauses(clause.OnConflict{
|
||||||
|
Columns: []clause.Column{{Name: "name"}},
|
||||||
|
DoNothing: true,
|
||||||
|
}).Create(&models.TagAlias{
|
||||||
Name: string(tagAliasName),
|
Name: string(tagAliasName),
|
||||||
TagID: string(tagID),
|
TagID: string(tagID),
|
||||||
})
|
})
|
||||||
|
@ -328,7 +328,7 @@ func TestCreateTagAlias(t *testing.T) {
|
|||||||
tagAliasName: validTagAliasName01,
|
tagAliasName: validTagAliasName01,
|
||||||
tagID: validTagID,
|
tagID: validTagID,
|
||||||
},
|
},
|
||||||
wantErr: true,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test 6: Invalide tagID",
|
name: "Test 6: Invalide tagID",
|
||||||
|
Reference in New Issue
Block a user