Skip to content

Commit

Permalink
[#119] Edit docs and README
Browse files Browse the repository at this point in the history
  • Loading branch information
sancho20021 committed Aug 2, 2022
1 parent 13fa4f7 commit 6bd6412
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Available commands:
returning only the specified field for each entry
create Create a new entry at the specified path
set-field Set a field on the entry at the specified path
set-field-visibility Set a field's visibility on the entry at the specified path
delete-field Delete a field from the entry at the specified path
find Find and list entries, optionally filtering
rename Rename an entry or directory
Expand Down
1 change: 0 additions & 1 deletion app/cli/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ main = do
res@SFREntryNotFound{} -> printError $ buildSetFieldResult CLI res
res@SFRSuccess{} -> printSuccess $ buildSetFieldResult CLI res


SomeCommand cmd@CmdSetFieldVisibility{} -> do
runCommand config cmd >>= \case
res@SFVREntryNotFound{} -> printError $ buildSetFieldVisibilityResult CLI res
Expand Down
10 changes: 8 additions & 2 deletions docs/web-api-error-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
These codes are grouped in the following way:
- `view` errors: 100-102
- `create` errors: 200-202
- `set-field` errors: 300-301
- `set-field` errors: 300
- `set-field-visibility` errors: 350-351
- `delete-field` errors: 400-401
- `rename`/`copy` errors: 500-505
- `delete` errors: 600-601
Expand Down Expand Up @@ -37,7 +38,12 @@ See the following tables for detailed explanations of error codes.
| Error | Code |
|:-----------------------|:----:|
| Entry not found | 300 |
| Missing field contents | 301 |

## Set-field-visibility
| Error | Code |
|:-----------------------|:----:|
| Entry not found | 350 |
| Field not found | 351 |

## Delete-field
| Error | Code |
Expand Down
2 changes: 1 addition & 1 deletion lib/Backend/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ setFieldCmd
updateOrInsertField nowUtc

updateOrInsertField :: UTCTime -> Maybe Field -> Field
updateOrInsertField nowUtc fieldMb = case fieldMb of
updateOrInsertField nowUtc = \case
Nothing ->
-- The field does not yet exist, insert a new one.
newField nowUtc fieldContents
Expand Down
4 changes: 2 additions & 2 deletions lib/Web/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ handleSetFieldVisibilityResult :: SetFieldVisibilityResult -> Handler Entry
handleSetFieldVisibilityResult = \case
SFVRSuccess _ qEntry -> pure $ qpPath qEntry
res@SFVREntryNotFound{} ->
throwCofferServerError err404 300 (pretty res)
throwCofferServerError err404 350 (pretty res)
res@SFVRFieldNotFound{} ->
throwCofferServerError err404 301 (pretty res)
throwCofferServerError err404 351 (pretty res)
where
pretty = resultToText buildSetFieldVisibilityResult

Expand Down

0 comments on commit 6bd6412

Please sign in to comment.