-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#119] Refactor set-field
in CLI and WebAPI
#130
base: main
Are you sure you want to change the base?
Conversation
Problem: `set-field` route was used both for changing visibility and setting fields. This resulted in ambiguous behavior in case of missing contents and visibility options. Solution: require contents for setting field and allow changing visibility for convenience. Add `set-field-visibility` request which doesn't require field contents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
(not touching Web part)
app/cli/Main.hs
Outdated
res@SFRSuccess{} -> printSuccess $ buildSetFieldResult CLI res | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra \n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
lib/Backend/Commands.hs
Outdated
updateOrInsertField :: UTCTime -> Maybe Field -> Sem r (Maybe Field) | ||
updateOrInsertField nowUtc = \case | ||
updateOrInsertField :: UTCTime -> Maybe Field -> Field | ||
updateOrInsertField nowUtc fieldMb = case fieldMb of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\case?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks
lib/Web/Server.hs
Outdated
@@ -125,23 +134,29 @@ reportErrors io = do | |||
Right (Right a) -> do | |||
return a | |||
|
|||
-- setFieldVisibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like leftover
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100%. Sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've added new cmd. Seems we have to add it to README
Problem: See issue #119. Solution: Split `set-field` command into a `set-field` with contents and `set-field-visibility`.
01f4190
to
6bd6412
Compare
True. Fixed. And also documentation about status codes |
set-field
in CLIset-field
in CLI and WebAPI
Description
Problem: currently
set-field
is used both for changing visibilityand setting new fields. This results in additional handling of the
situation where both field contents and visibility option are missing.
Solution: require contents for setting field and allow changing
visibility for convenience. Add
set-field-visibility
command in CLI and route in WebAPIwhich modifies only visibility.
Related issue(s)
Fixes #119
✅ Checklist for your Pull Request
Related changes (conditional)
Tests
silently reappearing again.
Documentation
Stylistic guide (mandatory)