Added option to specify created conversation is a DM
parent
1064edce60
commit
a48a4f4e2d
|
@ -23,14 +23,14 @@ Supply environment variables by either exporting them or editing ```.env```.
|
|||
|
||||
## API
|
||||
|
||||
Unless otherwise noted, bodies and responses are with `Content-Type: application/json`. Endpoints marked with a `*` require a populated `X-User-Claim` header from `backend-auth`.
|
||||
Unless otherwise noted, bodies and responses are with `Content-Type: application/json`. Endpoints marked with a ```*``` require a populated `X-User-Claim` header from `backend-auth`.
|
||||
|
||||
| Contents |
|
||||
| -------- |
|
||||
| [Create User](#Create-User) |
|
||||
| [Get Users by Phone](#Get-Users-by-Phone) |
|
||||
| [Get User by ID](#Get-User-by-ID) |
|
||||
| [Get User by Username(#Get-User-by-Username) ]
|
||||
| [Get User by Username](#Get-User-by-Username) ]
|
||||
| [Update User](#Update-User) |
|
||||
| [Create Conversation](#Create-Conversation) |
|
||||
| [Delete Conversation](#Delete-Conversation) |
|
||||
|
@ -252,6 +252,7 @@ Create a new conversation for a user.
|
|||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| title | String | Title of the conversation | X |
|
||||
| dm | Boolean | Whether the conversation is a DM or not | X |
|
||||
|
||||
#### Success Response (200 OK)
|
||||
|
||||
|
|
|
@ -225,8 +225,8 @@ func (h *Handler) CreateConversation(w http.ResponseWriter, r *http.Request, p h
|
|||
|
||||
// Conversation
|
||||
_, err1 := tx.Exec(`
|
||||
INSERT INTO "conversation" (id, title) VALUES ($1, $2)
|
||||
`, conversation.ID, conversation.Title)
|
||||
INSERT INTO "conversation" (id, title, dm) VALUES ($1, $2, $3)
|
||||
`, conversation.ID, conversation.Title, conversation.DM)
|
||||
// First member
|
||||
_, err2 := tx.Exec(`
|
||||
INSERT INTO member ("user", "conversation") VALUES ($1, $2)
|
||||
|
|
Loading…
Reference in New Issue