-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42cd7b9
commit 42c8592
Showing
21 changed files
with
452 additions
and
57 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
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
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 was deleted.
Oops, something went wrong.
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,19 @@ | ||
package controllers | ||
|
||
import "net/http" | ||
|
||
func CreateGroupUser(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func DeleteGroupUser(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func UpdateGroupUser(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func GetGroupUser(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func GetAllGroupUser(w http.ResponseWriter, r *http.Request) { | ||
|
||
} |
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,19 @@ | ||
package controllers | ||
|
||
import "net/http" | ||
|
||
func CreateGroup(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func DeleteGroup(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func UpdateGroup(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func GetGroup(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func GetAllGroup(w http.ResponseWriter, r *http.Request) { | ||
|
||
} |
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 |
---|---|---|
@@ -1,17 +1,102 @@ | ||
package controllers | ||
|
||
func CreateReminder() { | ||
import ( | ||
"net/http" | ||
|
||
"github.com/gorilla/context" | ||
"github.com/piyush7833/Chat-Api/config" | ||
"github.com/piyush7833/Chat-Api/functions" | ||
"github.com/piyush7833/Chat-Api/helpers" | ||
"github.com/piyush7833/Chat-Api/types" | ||
) | ||
|
||
func CreateReminder(w http.ResponseWriter, r *http.Request) { | ||
JwtData := context.Get(r, "userId").(*helpers.Claims) | ||
var reminder types.CreateReminderType | ||
err := helpers.GetBodyInJson(r, &reminder) | ||
if err != nil { | ||
helpers.Error(w, 500, err.Error()) | ||
return | ||
} | ||
// fmt.Println("Reminder:", reminder) | ||
reminder.SenderId = &JwtData.Id | ||
res, error := functions.CreateReminder(reminder) | ||
|
||
if error.StatusCode != 0 { | ||
helpers.Error(w, error.StatusCode, error.Message) | ||
return | ||
} | ||
helpers.Success(w, 201, res, "Reminder created successfully") | ||
} | ||
func UpdateReminder() { | ||
|
||
func GetParticularReminder(w http.ResponseWriter, r *http.Request) { | ||
queryValues := r.URL.Query() | ||
|
||
JwtData := context.Get(r, "userId").(*helpers.Claims) | ||
id := helpers.ProcessQuerryParams(queryValues["id"], []string{""}, "string").(string) | ||
// fmt.Println(id) | ||
page := helpers.ProcessQuerryParams(queryValues["page"], []string{"0"}, "number").(int) | ||
selectedColumns := helpers.ProcessQuerryParams(queryValues["columns"], config.GetDefaultReminderColumns(), "array").([]string) | ||
orderByColumns := helpers.ProcessQuerryParams(queryValues["orderBy"], []string{"createdAt"}, "array").([]string) | ||
isDesc := helpers.ProcessQuerryParams(queryValues["isDesc"], []string{"true"}, "bool").(bool) | ||
|
||
res, err := functions.GetParticularReminder(JwtData.Id, id, page, selectedColumns, orderByColumns, isDesc) | ||
if err.StatusCode != 0 { | ||
helpers.Error(w, err.StatusCode, err.Message) | ||
return | ||
} | ||
|
||
helpers.Success(w, 200, res, "Reminder fetched successfully") | ||
|
||
} | ||
func DeleteReminder() { | ||
func GetAllReminder(w http.ResponseWriter, r *http.Request) { | ||
queryValues := r.URL.Query() | ||
|
||
JwtData := context.Get(r, "userId").(*helpers.Claims) | ||
page := helpers.ProcessQuerryParams(queryValues["page"], []string{"0"}, "number").(int) | ||
reminder_type := helpers.ProcessQuerryParams(queryValues["type"], []string{"all"}, "string").(string) | ||
selectedColumns := helpers.ProcessQuerryParams(queryValues["columns"], config.GetDefaultReminderColumns(), "array").([]string) | ||
orderByColumns := helpers.ProcessQuerryParams(queryValues["orderBy"], []string{"createdAt"}, "array").([]string) | ||
isDesc := helpers.ProcessQuerryParams(queryValues["isDesc"], []string{"true"}, "bool").(bool) | ||
|
||
res, err := functions.GetAllReminder(JwtData.Id, page, reminder_type, selectedColumns, orderByColumns, isDesc) | ||
if err.StatusCode != 0 { | ||
helpers.Error(w, err.StatusCode, err.Message) | ||
return | ||
} | ||
|
||
helpers.Success(w, 200, res, "Reminder fetched successfully") | ||
} | ||
func GetReminder() { | ||
func UpdateReminder(w http.ResponseWriter, r *http.Request) { | ||
JwtData := context.Get(r, "userId").(*helpers.Claims) | ||
queryValues := r.URL.Query() | ||
|
||
var reminder types.UpdateReminderType | ||
id := helpers.ProcessQuerryParams(queryValues["id"], []string{""}, "string").(string) | ||
|
||
err := helpers.GetBodyInJson(r, &reminder) | ||
if err != nil { | ||
helpers.Error(w, 500, err.Error()) | ||
return | ||
} | ||
|
||
res, error := functions.UpdateReminder(reminder, id, JwtData.Id) | ||
if error.StatusCode != 0 { | ||
helpers.Error(w, error.StatusCode, error.Message) | ||
return | ||
} | ||
helpers.Success(w, 200, res, "Reminder updated successfully") | ||
} | ||
func GetAllReminder() { | ||
|
||
func DeleteReminder(w http.ResponseWriter, r *http.Request) { | ||
JwtData := context.Get(r, "userId").(*helpers.Claims) | ||
queryValues := r.URL.Query() | ||
id := helpers.ProcessQuerryParams(queryValues["id"], []string{""}, "string").(string) | ||
|
||
res, error := functions.DeleteReminder(id, JwtData.Id) | ||
if error.StatusCode != 0 { | ||
helpers.Error(w, error.StatusCode, error.Message) | ||
return | ||
} | ||
helpers.Success(w, 200, res, "Reminder deleted successfully") | ||
} |
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 |
---|---|---|
@@ -1,20 +1,22 @@ | ||
package controllers | ||
|
||
func CreateStatus() { | ||
import "net/http" | ||
|
||
func CreateStatus(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func UpdateStatus() { | ||
func UpdateStatus(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func DeleteStatus() { | ||
func DeleteStatus(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func GetStatus() { | ||
func GetStatus(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func GetAllStatusOfUser() { | ||
func GetAllStatusOfUser(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func GetAllStatusOfUsersFriend() { | ||
func GetAllStatusOfUsersFriend(w http.ResponseWriter, r *http.Request) { | ||
|
||
} |
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 |
---|---|---|
@@ -1,17 +1,19 @@ | ||
package controllers | ||
|
||
func CreateTag() { | ||
import "net/http" | ||
|
||
func CreateTag(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func DeleteTag() { | ||
func DeleteTag(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func UpdateTag() { | ||
func UpdateTag(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func GetTag() { | ||
func GetTag(w http.ResponseWriter, r *http.Request) { | ||
|
||
} | ||
func GetAllTag() { | ||
func GetAllTag(w http.ResponseWriter, r *http.Request) { | ||
|
||
} |
Oops, something went wrong.