feat(views): create default views when creating a filter

This commit is contained in:
kolaente 2024-03-14 15:42:15 +01:00
parent 2096fc5274
commit 4149ebed3a
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 7 additions and 2 deletions

View File

@ -116,9 +116,14 @@ func (sf *SavedFilter) toProject() *Project {
// @Failure 403 {object} web.HTTPError "The user does not have access to that saved filter."
// @Failure 500 {object} models.Message "Internal error"
// @Router /filters [put]
func (sf *SavedFilter) Create(s *xorm.Session, auth web.Auth) error {
func (sf *SavedFilter) Create(s *xorm.Session, auth web.Auth) (err error) {
sf.OwnerID = auth.GetID()
_, err := s.Insert(sf)
_, err = s.Insert(sf)
if err != nil {
return
}
err = CreateDefaultViewsForProject(s, &Project{ID: getProjectIDFromSavedFilterID(sf.ID)}, auth)
return err
}