Skip to content

Commit

Permalink
fix cms page update
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Feb 14, 2024
1 parent f286f08 commit aea0cd7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/cms/src/main/CmsApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class CmsApi(coll: Coll, markup: CmsMarkup)(using Executor):
def create(page: CmsPage): Funit = coll.insert.one(page).void

def update(prev: CmsPage, data: CmsForm.CmsPageData)(using me: Me): Fu[CmsPage] =
val page = data update me
val page = data.update(prev, me)
coll.update.one($id(page.id), page) inject page

def delete(id: Id): Funit = coll.delete.one($id(id)).void
Expand Down
2 changes: 1 addition & 1 deletion modules/cms/src/main/CmsForm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ object CmsForm:
by = user.id
)

def update(user: User) = create(user)
def update(prev: CmsPage, user: User) = create(user).copy(id = prev.id)

0 comments on commit aea0cd7

Please sign in to comment.