[#119] Refactor set-field in CLI and WebAPI#130
Open
sancho20021 wants to merge 6 commits intomainfrom
Open
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.
Kariel-Myrr
reviewed
Aug 1, 2022
Contributor
Kariel-Myrr
left a comment
There was a problem hiding this comment.
LGTM
(not touching Web part)
app/cli/Main.hs
Outdated
| res@SFRMissingFieldContents{} -> printError $ buildSetFieldResult CLI res | ||
| res@SFRSuccess{} -> printSuccess $ buildSetFieldResult CLI res | ||
|
|
||
|
|
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 |
lib/Web/Server.hs
Outdated
| Right (Right a) -> do | ||
| return a | ||
|
|
||
| -- setFieldVisibility |
Kariel-Myrr
suggested changes
Aug 1, 2022
Contributor
Kariel-Myrr
left a comment
There was a problem hiding this comment.
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
Contributor
Author
True. Fixed. And also documentation about status codes |
5 tasks
set-field in CLIset-field in CLI and WebAPI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem: currently
set-fieldis 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-visibilitycommand 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)