frontend+backend: fix gateway-updated channel order
This commit is contained in:
parent
381f1ae454
commit
541464cdd9
4 changed files with 21 additions and 21 deletions
|
@ -4,8 +4,8 @@
|
|||
</script>
|
||||
|
||||
<div class="sidebar">
|
||||
{#each $channels as channel}
|
||||
<button class="sidebar-button">
|
||||
{#each $channels as channel (channel.id)}
|
||||
<button class="sidebar-button" >
|
||||
<div>
|
||||
<HashIcon />
|
||||
</div>
|
||||
|
|
|
@ -49,7 +49,7 @@ export const channels = {
|
|||
if (!index)
|
||||
return;
|
||||
|
||||
this._value.splice(index);
|
||||
this._value.splice(index, 1);
|
||||
|
||||
this._dispatchUpdate();
|
||||
});
|
||||
|
|
|
@ -221,7 +221,7 @@ export default function(server: Server) {
|
|||
sessions.add(ws);
|
||||
|
||||
// TODO: each user should have their own list of channels that they join
|
||||
const channels = await query("SELECT id, name, owner_id FROM channels");
|
||||
const channels = await query("SELECT id, name, owner_id FROM channels ORDER BY id ASC");
|
||||
|
||||
clientSubscribe(ws, "*");
|
||||
channels.rows.forEach(c => {
|
||||
|
|
34
test.rest
34
test.rest
|
@ -19,65 +19,65 @@ content-type: application/json
|
|||
###
|
||||
|
||||
GET http://localhost:3000/api/v1/users/self HTTP/1.1
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjUwMTUyNjQ2LCJleHAiOjE2NTAzMjU0NDZ9.eFjOjJV3rIZWN0WrdRblflh2q8dYDGQv4qxugjbYNFk
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwMjA1MDEwLCJleHAiOjE2NTAzNzc4MTB9.ITaXBm7zVxh_s5xrCFXM1ScVL-igGJf1Qz2l_tLZf4A
|
||||
|
||||
###
|
||||
|
||||
POST http://localhost:3000/api/v1/channels HTTP/1.1
|
||||
content-type: application/json
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjUwMTUyNjQ2LCJleHAiOjE2NTAzMjU0NDZ9.eFjOjJV3rIZWN0WrdRblflh2q8dYDGQv4qxugjbYNFk
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwMjA1MDEwLCJleHAiOjE2NTAzNzc4MTB9.ITaXBm7zVxh_s5xrCFXM1ScVL-igGJf1Qz2l_tLZf4A
|
||||
|
||||
{
|
||||
"name": "idk what to call these"
|
||||
"name": "channel 4"
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
PUT http://localhost:3000/api/v1/channels/5 HTTP/1.1
|
||||
PUT http://localhost:3000/api/v1/channels/7 HTTP/1.1
|
||||
content-type: application/json
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjUwMTUyNjQ2LCJleHAiOjE2NTAzMjU0NDZ9.eFjOjJV3rIZWN0WrdRblflh2q8dYDGQv4qxugjbYNFk
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwMjA1MDEwLCJleHAiOjE2NTAzNzc4MTB9.ITaXBm7zVxh_s5xrCFXM1ScVL-igGJf1Qz2l_tLZf4A
|
||||
#Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjQ5MjU5NDUwLCJleHAiOjE2NDk0MzIyNTB9.JmF9NujFZnln7A-ynNpeyayGBqmR5poAyACYV6RnSQY
|
||||
|
||||
{
|
||||
"name": "idk what to put here"
|
||||
"name": "modified channel 2"
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
DELETE http://localhost:3000/api/v1/channels/10 HTTP/1.1
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjUwMTUyNjQ2LCJleHAiOjE2NTAzMjU0NDZ9.eFjOjJV3rIZWN0WrdRblflh2q8dYDGQv4qxugjbYNFk
|
||||
DELETE http://localhost:3000/api/v1/channels/9 HTTP/1.1
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwMjA1MDEwLCJleHAiOjE2NTAzNzc4MTB9.ITaXBm7zVxh_s5xrCFXM1ScVL-igGJf1Qz2l_tLZf4A
|
||||
#Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjQ5MjU5NDUwLCJleHAiOjE2NDk0MzIyNTB9.JmF9NujFZnln7A-ynNpeyayGBqmR5poAyACYV6RnSQY
|
||||
|
||||
###
|
||||
|
||||
GET http://localhost:3000/api/v1/channels/1 HTTP/1.1
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjUwMTUyNjQ2LCJleHAiOjE2NTAzMjU0NDZ9.eFjOjJV3rIZWN0WrdRblflh2q8dYDGQv4qxugjbYNFk
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwMjA1MDEwLCJleHAiOjE2NTAzNzc4MTB9.ITaXBm7zVxh_s5xrCFXM1ScVL-igGJf1Qz2l_tLZf4A
|
||||
|
||||
###
|
||||
|
||||
GET http://localhost:3000/api/v1/channels HTTP/1.1
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjUwMTUyNjQ2LCJleHAiOjE2NTAzMjU0NDZ9.eFjOjJV3rIZWN0WrdRblflh2q8dYDGQv4qxugjbYNFk
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwMjA1MDEwLCJleHAiOjE2NTAzNzc4MTB9.ITaXBm7zVxh_s5xrCFXM1ScVL-igGJf1Qz2l_tLZf4A
|
||||
|
||||
###
|
||||
|
||||
POST http://localhost:3000/api/v1/channels/5/messages HTTP/1.1
|
||||
POST http://localhost:3000/api/v1/channels/1/messages HTTP/1.1
|
||||
content-type: application/json
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjUwMTUyNjQ2LCJleHAiOjE2NTAzMjU0NDZ9.eFjOjJV3rIZWN0WrdRblflh2q8dYDGQv4qxugjbYNFk
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwMjA1MDEwLCJleHAiOjE2NTAzNzc4MTB9.ITaXBm7zVxh_s5xrCFXM1ScVL-igGJf1Qz2l_tLZf4A
|
||||
|
||||
{
|
||||
"content": "i hate cheese"
|
||||
"content": "i love cheese"
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
GET http://localhost:3000/api/v1/channels/5/messages HTTP/1.1
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjUwMTUyNjQ2LCJleHAiOjE2NTAzMjU0NDZ9.eFjOjJV3rIZWN0WrdRblflh2q8dYDGQv4qxugjbYNFk
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwMjA1MDEwLCJleHAiOjE2NTAzNzc4MTB9.ITaXBm7zVxh_s5xrCFXM1ScVL-igGJf1Qz2l_tLZf4A
|
||||
|
||||
###
|
||||
|
||||
PUT http://localhost:3000/api/v1/messages/3 HTTP/1.1
|
||||
content-type: application/json
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjUwMTUyNjQ2LCJleHAiOjE2NTAzMjU0NDZ9.eFjOjJV3rIZWN0WrdRblflh2q8dYDGQv4qxugjbYNFk
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwMjA1MDEwLCJleHAiOjE2NTAzNzc4MTB9.ITaXBm7zVxh_s5xrCFXM1ScVL-igGJf1Qz2l_tLZf4A
|
||||
|
||||
{
|
||||
"content": "hello again!"
|
||||
|
@ -86,9 +86,9 @@ Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6M
|
|||
###
|
||||
|
||||
GET http://localhost:3000/api/v1/messages/3
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjUwMTUyNjQ2LCJleHAiOjE2NTAzMjU0NDZ9.eFjOjJV3rIZWN0WrdRblflh2q8dYDGQv4qxugjbYNFk
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwMjA1MDEwLCJleHAiOjE2NTAzNzc4MTB9.ITaXBm7zVxh_s5xrCFXM1ScVL-igGJf1Qz2l_tLZf4A
|
||||
|
||||
###
|
||||
|
||||
DELETE http://localhost:3000/api/v1/messages/2 HTTP/1.1
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjUwMTUyNjQ2LCJleHAiOjE2NTAzMjU0NDZ9.eFjOjJV3rIZWN0WrdRblflh2q8dYDGQv4qxugjbYNFk
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwMjA1MDEwLCJleHAiOjE2NTAzNzc4MTB9.ITaXBm7zVxh_s5xrCFXM1ScVL-igGJf1Qz2l_tLZf4A
|
||||
|
|
Loading…
Reference in a new issue