Adds the capability to retrieve a property field by name (#30859)

* Adds the capability to retrieve a property field by name

Allows to retrieve a property field by name and groupID. As the name
is only unique within the context of a group, and we can have multiple
fields with the same name in the store, for this method the groupID is
directly included in the query instead of being an optional field.

* Adds the targetID parameter to correctly filter fields

* Ensure the method only retrieves non-deleted fields

---------

Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Miguel de la Cruz
2025-05-13 12:45:35 +02:00
коммит произвёл GitHub
родитель 64ed8f02dc
Коммит 6ab6a008e6
7 изменённых файлов: 244 добавлений и 0 удалений

Просмотреть файл

@@ -120,6 +120,36 @@ func (_m *PropertyFieldStore) Get(groupID string, id string) (*model.PropertyFie
return r0, r1
}
// GetFieldByName provides a mock function with given fields: groupID, targetID, name
func (_m *PropertyFieldStore) GetFieldByName(groupID string, targetID string, name string) (*model.PropertyField, error) {
ret := _m.Called(groupID, targetID, name)
if len(ret) == 0 {
panic("no return value specified for GetFieldByName")
}
var r0 *model.PropertyField
var r1 error
if rf, ok := ret.Get(0).(func(string, string, string) (*model.PropertyField, error)); ok {
return rf(groupID, targetID, name)
}
if rf, ok := ret.Get(0).(func(string, string, string) *model.PropertyField); ok {
r0 = rf(groupID, targetID, name)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.PropertyField)
}
}
if rf, ok := ret.Get(1).(func(string, string, string) error); ok {
r1 = rf(groupID, targetID, name)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetMany provides a mock function with given fields: groupID, ids
func (_m *PropertyFieldStore) GetMany(groupID string, ids []string) ([]*model.PropertyField, error) {
ret := _m.Called(groupID, ids)