-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`GET` endpoint: - Added new handler for fetching previously uploaded images from Urchin. - Added structs to allow handling of responses with compiler support. - Added required functions for the database to fetch images. `DELETE` endpoint: - Added new handler for deleting previously uploaded images from Urchin. - Added required functions for the database to delete images. General update: - Added structs to allow handling of responses with compiler support. - Restructured API to used path variables for the delete endpoints. --------- Co-authored-by: matheusgomes28 <[email protected]>
- Loading branch information
1 parent
cf04c2f
commit 5372b61
Showing
26 changed files
with
781 additions
and
235 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package admin_app | ||
|
||
import "github.com/matheusgomes28/urchin/common" | ||
|
||
// Extracted all bindings and requests structs into a single package to | ||
// organize the data in a simpler way. Every domain object supporting | ||
// CRUD endpoints has their own structures to handle the http methods. | ||
|
||
type DeletePostBinding struct { | ||
common.IntIdBinding | ||
} | ||
|
||
type AddPostRequest struct { | ||
Title string `json:"title"` | ||
Excerpt string `json:"excerpt"` | ||
Content string `json:"content"` | ||
} | ||
|
||
type ChangePostRequest struct { | ||
Id int `json:"id"` | ||
Title string `json:"title"` | ||
Excerpt string `json:"excerpt"` | ||
Content string `json:"content"` | ||
} | ||
|
||
type AddImageRequest struct { | ||
Alt string `json:"alt"` | ||
} | ||
|
||
type DeleteImageBinding struct { | ||
common.StringIdBinding | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package admin_app | ||
|
||
type PostIdResponse struct { | ||
Id int `json:"id"` | ||
} | ||
|
||
type GetPostResponse struct { | ||
Id int `json:"id"` | ||
Title string `json:"title"` | ||
Excerpt string `json:"excerpt"` | ||
Content string `json:"content"` | ||
} | ||
|
||
type ImageIdResponse struct { | ||
Id string `json:"id"` | ||
} | ||
|
||
type GetImageResponse struct { | ||
Id string `json:"id"` | ||
Name string `json:"name"` | ||
AltText string `json:"alt_text"` | ||
Extension string `json:"extension"` | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.