forked from vieter-v/vieter
docs: added comment string to each function
This commit is contained in:
parent
fb65efdfbe
commit
f9f440500e
12 changed files with 49 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ import response { new_data_response, new_response }
|
|||
|
||||
const repos_file = 'repos.json'
|
||||
|
||||
// get_repos returns the current list of repos.
|
||||
['/api/repos'; get]
|
||||
fn (mut app App) get_repos() web.Result {
|
||||
if !app.is_authorized() {
|
||||
|
|
@ -25,6 +26,7 @@ fn (mut app App) get_repos() web.Result {
|
|||
return app.json(http.Status.ok, new_data_response(repos))
|
||||
}
|
||||
|
||||
// get_single_repo returns the information for a single repo.
|
||||
['/api/repos/:id'; get]
|
||||
fn (mut app App) get_single_repo(id string) web.Result {
|
||||
if !app.is_authorized() {
|
||||
|
|
@ -48,6 +50,7 @@ fn (mut app App) get_single_repo(id string) web.Result {
|
|||
return app.json(http.Status.ok, new_data_response(repo))
|
||||
}
|
||||
|
||||
// post_repo creates a new repo from the provided query string.
|
||||
['/api/repos'; post]
|
||||
fn (mut app App) post_repo() web.Result {
|
||||
if !app.is_authorized() {
|
||||
|
|
@ -86,6 +89,7 @@ fn (mut app App) post_repo() web.Result {
|
|||
return app.json(http.Status.ok, new_response('Repo added successfully.'))
|
||||
}
|
||||
|
||||
// delete_repo removes a given repo from the server's list.
|
||||
['/api/repos/:id'; delete]
|
||||
fn (mut app App) delete_repo(id string) web.Result {
|
||||
if !app.is_authorized() {
|
||||
|
|
@ -113,6 +117,7 @@ fn (mut app App) delete_repo(id string) web.Result {
|
|||
return app.json(http.Status.ok, new_response('Repo removed successfully.'))
|
||||
}
|
||||
|
||||
// patch_repo updates a repo's data with the given query params.
|
||||
['/api/repos/:id'; patch]
|
||||
fn (mut app App) patch_repo(id string) web.Result {
|
||||
if !app.is_authorized() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue