fix: Cleanup formatting and add pinned chats schema
parent
e81b91eebb
commit
54e6ae658d
|
@ -183,7 +183,7 @@ func (h *Handler) UpdateUser(w http.ResponseWriter, r *http.Request, p httproute
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
w.WriteHeader(200);
|
w.WriteHeader(200)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) CreateConversation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
func (h *Handler) CreateConversation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
||||||
|
@ -358,7 +358,7 @@ func (h *Handler) UpdateConversation(w http.ResponseWriter, r *http.Request, p h
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
w.WriteHeader(200);
|
w.WriteHeader(200)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) DeleteConversation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
func (h *Handler) DeleteConversation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
||||||
|
@ -555,6 +555,7 @@ func (h *Handler) GetConversationMembers(w http.ResponseWriter, r *http.Request,
|
||||||
type PhoneNumber struct {
|
type PhoneNumber struct {
|
||||||
PhoneNumber string `json:"phone_number"`
|
PhoneNumber string `json:"phone_number"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) CreateContact(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
func (h *Handler) CreateContact(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
||||||
// Parse
|
// Parse
|
||||||
userID := r.Context().Value("user").(string)
|
userID := r.Context().Value("user").(string)
|
||||||
|
|
1
main.go
1
main.go
|
@ -73,6 +73,7 @@ type RawClient struct {
|
||||||
UserId string `json:"userid"`
|
UserId string `json:"userid"`
|
||||||
ClientId string `json:"clientid"`
|
ClientId string `json:"clientid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func AuthMiddleware(next httprouter.Handle) httprouter.Handle {
|
func AuthMiddleware(next httprouter.Handle) httprouter.Handle {
|
||||||
return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
||||||
ua := r.Header.Get("X-User-Claim")
|
ua := r.Header.Get("X-User-Claim")
|
||||||
|
|
|
@ -28,6 +28,12 @@ CREATE TABLE IF NOT EXISTS contact (
|
||||||
UNIQUE ("user", contact)
|
UNIQUE ("user", contact)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS pinned_conversation (
|
||||||
|
"user" BYTEA REFERENCES "user"(id),
|
||||||
|
"conversation" BYTEA REFERENCES "conversation"(id),
|
||||||
|
UNIQUE ("user", "conversation")
|
||||||
|
);
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION notify_permissions_new () RETURNS TRIGGER AS $$
|
CREATE OR REPLACE FUNCTION notify_permissions_new () RETURNS TRIGGER AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
PERFORM pg_notify('member_new', CONCAT(NEW."user", '+', NEW."conversation"));
|
PERFORM pg_notify('member_new', CONCAT(NEW."user", '+', NEW."conversation"));
|
||||||
|
|
Loading…
Reference in New Issue