summary refs log tree commit diff
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/assets/schemas.json1186
-rw-r--r--api/src/routes/channels/#channel_id/index.ts36
-rw-r--r--api/src/routes/channels/#channel_id/messages/#message_id/ack.ts2
-rw-r--r--api/src/routes/channels/#channel_id/messages/index.ts46
-rw-r--r--api/src/routes/channels/#channel_id/recipients.ts56
-rw-r--r--api/src/routes/sticker-packs/#id/index.ts18
-rw-r--r--api/src/routes/sticker-packs/index.ts10
-rw-r--r--api/src/routes/users/#id/profile.ts1
-rw-r--r--api/src/routes/users/@me/channels.ts36
-rw-r--r--api/src/routes/users/@me/relationships.ts19
10 files changed, 755 insertions, 655 deletions
diff --git a/api/assets/schemas.json b/api/assets/schemas.json
index e27087a9..bfe6092b 100644
--- a/api/assets/schemas.json
+++ b/api/assets/schemas.json
@@ -80,11 +80,30 @@
                 "type": "string"
             },
             "type": {
-                "$ref": "#/definitions/ChannelType"
+                "enum": [
+                    0,
+                    1,
+                    10,
+                    11,
+                    12,
+                    13,
+                    2,
+                    3,
+                    4,
+                    5,
+                    6
+                ],
+                "type": "number"
             },
             "topic": {
                 "type": "string"
             },
+            "icon": {
+                "type": [
+                    "null",
+                    "string"
+                ]
+            },
             "bitrate": {
                 "type": "integer"
             },
@@ -141,27 +160,7 @@
             }
         },
         "additionalProperties": false,
-        "required": [
-            "name",
-            "type"
-        ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -307,11 +306,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -367,11 +385,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -469,22 +483,6 @@
         },
         "additionalProperties": false,
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -630,11 +628,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -690,11 +707,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -741,22 +754,6 @@
         },
         "additionalProperties": false,
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -902,11 +899,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -962,11 +978,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -992,22 +1004,6 @@
         },
         "additionalProperties": false,
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -1153,11 +1149,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -1213,11 +1228,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -1246,22 +1257,6 @@
             "messages"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -1407,11 +1402,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -1467,11 +1481,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -1509,22 +1519,6 @@
             "type"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -1670,11 +1664,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -1730,11 +1743,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -1765,22 +1774,6 @@
             "name"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -1926,11 +1919,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -1986,11 +1998,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -2016,22 +2024,6 @@
         },
         "additionalProperties": false,
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -2177,11 +2169,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -2237,11 +2248,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -2279,22 +2286,6 @@
             ]
         },
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -2440,11 +2431,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -2500,11 +2510,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -2555,22 +2561,6 @@
             "name"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -2716,11 +2706,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -2776,11 +2785,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -2870,22 +2875,6 @@
             "name"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -3031,11 +3020,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -3091,11 +3099,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -3121,22 +3125,6 @@
         },
         "additionalProperties": false,
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -3282,11 +3270,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -3342,11 +3349,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -3372,22 +3375,6 @@
             "nick"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -3533,11 +3520,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -3593,11 +3599,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -3635,22 +3637,6 @@
         },
         "additionalProperties": false,
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -3796,11 +3782,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -3856,11 +3861,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -3893,22 +3894,6 @@
             ]
         },
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -4054,11 +4039,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -4114,11 +4118,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -4147,22 +4147,6 @@
             "name"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -4308,11 +4292,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -4368,11 +4371,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -4401,22 +4400,6 @@
             "name"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -4562,11 +4545,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -4622,11 +4624,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -4651,22 +4649,6 @@
         },
         "additionalProperties": false,
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -4812,11 +4794,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -4872,11 +4873,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -4921,22 +4918,6 @@
             "channel_id"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -5082,11 +5063,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -5142,11 +5142,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -5198,22 +5194,6 @@
         },
         "additionalProperties": false,
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -5359,11 +5339,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -5419,11 +5418,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -5453,22 +5448,6 @@
             "enabled"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -5614,11 +5593,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -5674,11 +5672,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -5710,22 +5704,6 @@
             "name"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -5871,11 +5849,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -5931,11 +5928,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -5967,22 +5960,6 @@
             "recipients"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -6128,11 +6105,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -6188,11 +6184,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -6245,22 +6237,6 @@
         },
         "additionalProperties": false,
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -6406,11 +6382,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -6466,11 +6461,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -6496,22 +6487,6 @@
             "type"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -6657,11 +6632,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -6717,11 +6711,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -6751,22 +6741,6 @@
             "username"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -6912,11 +6886,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -6972,11 +6965,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
@@ -7189,22 +7178,6 @@
             "timezone_offset"
         ],
         "definitions": {
-            "ChannelType": {
-                "enum": [
-                    0,
-                    1,
-                    10,
-                    11,
-                    12,
-                    13,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6
-                ],
-                "type": "number"
-            },
             "ChannelPermissionOverwriteType": {
                 "enum": [
                     0,
@@ -7350,11 +7323,30 @@
                         "type": "string"
                     },
                     "type": {
-                        "$ref": "#/definitions/ChannelType"
+                        "enum": [
+                            0,
+                            1,
+                            10,
+                            11,
+                            12,
+                            13,
+                            2,
+                            3,
+                            4,
+                            5,
+                            6
+                        ],
+                        "type": "number"
                     },
                     "topic": {
                         "type": "string"
                     },
+                    "icon": {
+                        "type": [
+                            "null",
+                            "string"
+                        ]
+                    },
                     "bitrate": {
                         "type": "integer"
                     },
@@ -7410,11 +7402,7 @@
                         "type": "integer"
                     }
                 },
-                "additionalProperties": false,
-                "required": [
-                    "name",
-                    "type"
-                ]
+                "additionalProperties": false
             },
             "RelationshipType": {
                 "enum": [
diff --git a/api/src/routes/channels/#channel_id/index.ts b/api/src/routes/channels/#channel_id/index.ts
index 02ac9884..70dd3994 100644
--- a/api/src/routes/channels/#channel_id/index.ts
+++ b/api/src/routes/channels/#channel_id/index.ts
@@ -1,6 +1,7 @@
-import { ChannelDeleteEvent, Channel, ChannelUpdateEvent, emitEvent, ChannelType, ChannelPermissionOverwriteType } from "@fosscord/util";
-import { Router, Response, Request } from "express";
-import { route } from "@fosscord/api";
+import { Channel, ChannelDeleteEvent, ChannelPermissionOverwriteType, ChannelService, ChannelType, ChannelUpdateEvent, emitEvent, Recipient } from "@fosscord/util";
+import { Request, Response, Router } from "express";
+import { handleFile, route } from "@fosscord/api";
+
 const router: Router = Router();
 // TODO: delete channel
 // TODO: Get channel
@@ -16,23 +17,37 @@ router.get("/", route({ permission: "VIEW_CHANNEL" }), async (req: Request, res:
 router.delete("/", route({ permission: "MANAGE_CHANNELS" }), async (req: Request, res: Response) => {
 	const { channel_id } = req.params;
 
-	const channel = await Channel.findOneOrFail({ id: channel_id });
+	const channel = await Channel.findOneOrFail({ where: { id: channel_id }, relations: ["recipients"] });
 
-	// TODO: Dm channel "close" not delete
-	const data = channel;
+	if (channel.type === ChannelType.DM) {
+		const recipient = await Recipient.findOneOrFail({ where: { channel_id: channel_id, user_id: req.user_id } })
+		recipient.closed = true
+		await Promise.all([
+			recipient.save(),
+			emitEvent({ event: "CHANNEL_DELETE", data: channel, user_id: req.user_id } as ChannelDeleteEvent)
+		]);
 
-	await Promise.all([emitEvent({ event: "CHANNEL_DELETE", data, channel_id } as ChannelDeleteEvent), Channel.delete({ id: channel_id })]);
+	} else if (channel.type === ChannelType.GROUP_DM) {
+		await ChannelService.removeRecipientFromChannel(channel, req.user_id)
+	} else {
+		//TODO messages in this channel should be deleted before deleting the channel
+		await Promise.all([
+			Channel.delete({ id: channel_id }),
+			emitEvent({ event: "CHANNEL_DELETE", data: channel, channel_id } as ChannelDeleteEvent)
+		]);
+	}
 
-	res.send(data);
+	res.send(channel);
 });
 
 export interface ChannelModifySchema {
 	/**
 	 * @maxLength 100
 	 */
-	name: string;
-	type: ChannelType;
+	name?: string;
+	type?: ChannelType;
 	topic?: string;
+	icon?: string | null;
 	bitrate?: number;
 	user_limit?: number;
 	rate_limit_per_user?: number;
@@ -53,6 +68,7 @@ export interface ChannelModifySchema {
 router.patch("/", route({ body: "ChannelModifySchema", permission: "MANAGE_CHANNELS" }), async (req: Request, res: Response) => {
 	var payload = req.body as ChannelModifySchema;
 	const { channel_id } = req.params;
+	if (payload.icon) payload.icon = await handleFile(`/channel-icons/${channel_id}`, payload.icon);
 
 	const channel = await Channel.findOneOrFail({ id: channel_id });
 	channel.assign(payload);
diff --git a/api/src/routes/channels/#channel_id/messages/#message_id/ack.ts b/api/src/routes/channels/#channel_id/messages/#message_id/ack.ts
index 97d1d19e..786e4581 100644
--- a/api/src/routes/channels/#channel_id/messages/#message_id/ack.ts
+++ b/api/src/routes/channels/#channel_id/messages/#message_id/ack.ts
@@ -26,7 +26,7 @@ router.post("/", route({ body: "MessageAcknowledgeSchema" }), async (req: Reques
 		data: {
 			channel_id,
 			message_id,
-			version: 496
+			version: 3763
 		}
 	} as MessageAckEvent);
 
diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts
index ec93649e..bb610a6a 100644
--- a/api/src/routes/channels/#channel_id/messages/index.ts
+++ b/api/src/routes/channels/#channel_id/messages/index.ts
@@ -1,9 +1,8 @@
 import { Router, Response, Request } from "express";
-import { Attachment, Channel, ChannelType, Embed, getPermission, Message } from "@fosscord/util";
+import { Attachment, Channel, ChannelType, DmChannelDTO, Embed, emitEvent, getPermission, Message, MessageCreateEvent } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
-import { route } from "@fosscord/api";
+import { handleMessage, postHandleMessage, route } from "@fosscord/api";
 import multer from "multer";
-import { sendMessage } from "@fosscord/api";
 import { uploadFile } from "@fosscord/api";
 import { FindManyOptions, LessThan, MoreThan } from "typeorm";
 
@@ -62,9 +61,9 @@ router.get("/", async (req: Request, res: Response) => {
 	if (!channel) throw new HTTPError("Channel not found", 404);
 
 	isTextChannel(channel.type);
-	const around = `${req.query.around}`;
-	const before = `${req.query.before}`;
-	const after = `${req.query.after}`;
+	const around = req.query.around ? `${req.query.around}` : undefined;
+	const before = req.query.before ? `${req.query.before}` : undefined;
+	const after = req.query.after ? `${req.query.after}` : undefined;
 	const limit = Number(req.query.limit) || 50;
 	if (limit < 1 || limit > 100) throw new HTTPError("limit must be between 1 and 100");
 
@@ -151,10 +150,12 @@ router.post(
 				return res.status(400).json(error);
 			}
 		}
+		//TODO querying the DB at every message post should be avoided, caching maybe?
+		const channel = await Channel.findOneOrFail({ where: { id: channel_id }, relations: ["recipients", "recipients.user"] })
 
 		const embeds = [];
 		if (body.embed) embeds.push(body.embed);
-		const data = await sendMessage({
+		let message = await handleMessage({
 			...body,
 			type: 0,
 			pinned: false,
@@ -162,9 +163,36 @@ router.post(
 			embeds,
 			channel_id,
 			attachments,
-			edited_timestamp: undefined
+			edited_timestamp: undefined,
+			timestamp: new Date()
 		});
 
-		return res.json(data);
+		message = await message.save()
+
+		await channel.assign({ last_message_id: message.id }).save()
+
+		if (channel.isDm()) {
+			const channel_dto = await DmChannelDTO.from(channel)
+
+			for (let recipient of channel.recipients!) {
+				if (recipient.closed) {
+					await emitEvent({
+						event: "CHANNEL_CREATE",
+						data: channel_dto.excludedRecipients([recipient.user_id]),
+						user_id: recipient.user_id
+					})
+				}
+			}
+
+			await Promise.all(channel.recipients!.map(async r => {
+				r.closed = false;
+				return await r.save()
+			}));
+		}
+
+		await emitEvent({ event: "MESSAGE_CREATE", channel_id: channel_id, data: message } as MessageCreateEvent)
+		postHandleMessage(message).catch((e) => {}); // no await as it shouldnt block the message send function and silently catch error
+
+		return res.json(message);
 	}
 );
diff --git a/api/src/routes/channels/#channel_id/recipients.ts b/api/src/routes/channels/#channel_id/recipients.ts
index ea6bc563..d88b38f3 100644
--- a/api/src/routes/channels/#channel_id/recipients.ts
+++ b/api/src/routes/channels/#channel_id/recipients.ts
@@ -1,5 +1,57 @@
-import { Router, Response, Request } from "express";
+import { Request, Response, Router } from "express";
+import { Channel, ChannelRecipientAddEvent, ChannelService, ChannelType, DiscordApiErrors, DmChannelDTO, emitEvent, PublicUserProjection, Recipient, User } from "@fosscord/util";
+
 const router: Router = Router();
-// TODO:
+
+router.put("/:user_id", async (req: Request, res: Response) => {
+	const { channel_id, user_id } = req.params;
+	const channel = await Channel.findOneOrFail({ where: { id: channel_id }, relations: ["recipients"] });
+
+	if (channel.type !== ChannelType.GROUP_DM) {
+		const recipients = [
+			...channel.recipients!.map(r => r.user_id),
+			user_id
+		].unique()
+
+		const new_channel = await ChannelService.createDMChannel(recipients, req.user_id)
+		return res.status(201).json(new_channel);
+	} else {
+		if (channel.recipients!.map(r => r.user_id).includes(user_id)) {
+			throw DiscordApiErrors.INVALID_RECIPIENT //TODO is this the right error?
+		}
+
+		channel.recipients!.push(new Recipient({ channel_id: channel_id, user_id: user_id }));
+		await channel.save()
+
+		await emitEvent({
+			event: "CHANNEL_CREATE",
+			data: await DmChannelDTO.from(channel, [user_id]),
+			user_id: user_id
+		});
+
+		await emitEvent({
+			event: "CHANNEL_RECIPIENT_ADD", data: {
+				channel_id: channel_id,
+				user: await User.findOneOrFail({ where: { id: user_id }, select: PublicUserProjection })
+			}, channel_id: channel_id
+		} as ChannelRecipientAddEvent);
+		return res.sendStatus(204);
+	}
+});
+
+router.delete("/:user_id", async (req: Request, res: Response) => {
+	const { channel_id, user_id } = req.params;
+	const channel = await Channel.findOneOrFail({ where: { id: channel_id }, relations: ["recipients"] });
+	if (!(channel.type === ChannelType.GROUP_DM && (channel.owner_id === req.user_id || user_id === req.user_id)))
+		throw DiscordApiErrors.MISSING_PERMISSIONS
+
+	if (!channel.recipients!.map(r => r.user_id).includes(user_id)) {
+		throw DiscordApiErrors.INVALID_RECIPIENT //TODO is this the right error?
+	}
+
+	await ChannelService.removeRecipientFromChannel(channel, user_id)
+
+	return res.sendStatus(204);
+});
 
 export default router;
diff --git a/api/src/routes/sticker-packs/#id/index.ts b/api/src/routes/sticker-packs/#id/index.ts
new file mode 100644
index 00000000..2344a48f
--- /dev/null
+++ b/api/src/routes/sticker-packs/#id/index.ts
@@ -0,0 +1,18 @@
+import { Request, Response, Router } from "express";
+
+const router: Router = Router();
+
+router.get("/", async (req: Request, res: Response) => {
+	//TODO
+	res.json({
+		id: "",
+		stickers: [],
+		name: "",
+		sku_id: "",
+		cover_sticker_id: "",
+		description: "",
+		banner_asset_id: ""
+	}).status(200);
+});
+
+export default router;
\ No newline at end of file
diff --git a/api/src/routes/sticker-packs/index.ts b/api/src/routes/sticker-packs/index.ts
new file mode 100644
index 00000000..6c4e46d8
--- /dev/null
+++ b/api/src/routes/sticker-packs/index.ts
@@ -0,0 +1,10 @@
+import { Request, Response, Router } from "express";
+
+const router: Router = Router();
+
+router.get("/", async (req: Request, res: Response) => {
+	//TODO
+	res.json({ sticker_packs: [] }).status(200);
+});
+
+export default router;
\ No newline at end of file
diff --git a/api/src/routes/users/#id/profile.ts b/api/src/routes/users/#id/profile.ts
index d60c4f86..06d5c38c 100644
--- a/api/src/routes/users/#id/profile.ts
+++ b/api/src/routes/users/#id/profile.ts
@@ -19,6 +19,7 @@ router.get("/", route({ response: { body: "UserProfileResponse" } }), async (req
 		connected_accounts: user.connected_accounts,
 		premium_guild_since: null, // TODO
 		premium_since: null, // TODO
+		mutual_guilds: [], // TODO {id: "", nick: null} when ?with_mutual_guilds=true
 		user: {
 			username: user.username,
 			discriminator: user.discriminator,
diff --git a/api/src/routes/users/@me/channels.ts b/api/src/routes/users/@me/channels.ts
index da33f204..873ff245 100644
--- a/api/src/routes/users/@me/channels.ts
+++ b/api/src/routes/users/@me/channels.ts
@@ -1,15 +1,12 @@
-import { Router, Request, Response } from "express";
-import { Channel, ChannelCreateEvent, ChannelType, Snowflake, trimSpecial, User, emitEvent, Recipient } from "@fosscord/util";
-import { HTTPError } from "lambert-server";
+import { Request, Response, Router } from "express";
+import { Recipient, ChannelService, DmChannelDTO } from "@fosscord/util";
 import { route } from "@fosscord/api";
-import { In } from "typeorm";
 
 const router: Router = Router();
 
 router.get("/", route({}), async (req: Request, res: Response) => {
-	const recipients = await Recipient.find({ where: { user_id: req.user_id }, relations: ["channel"] });
-
-	res.json(recipients.map((x) => x.channel));
+	const recipients = await Recipient.find({ where: { user_id: req.user_id, closed: false }, relations: ["channel", "channel.recipients"] });
+	res.json(await Promise.all(recipients.map(r => DmChannelDTO.from(r.channel, [req.user_id]))));
 });
 
 export interface DmChannelCreateSchema {
@@ -19,30 +16,7 @@ export interface DmChannelCreateSchema {
 
 router.post("/", route({ body: "DmChannelCreateSchema" }), async (req: Request, res: Response) => {
 	const body = req.body as DmChannelCreateSchema;
-
-	body.recipients = body.recipients.filter((x) => x !== req.user_id).unique();
-
-	const recipients = await User.find({ where: body.recipients.map((x) => ({ id: x })) });
-
-	if (recipients.length !== body.recipients.length) {
-		throw new HTTPError("Recipient/s not found");
-	}
-
-	const type = body.recipients.length === 1 ? ChannelType.DM : ChannelType.GROUP_DM;
-	const name = trimSpecial(body.name);
-
-	const channel = await new Channel({
-		name,
-		type,
-		// owner_id only for group dm channels
-		created_at: new Date(),
-		last_message_id: null,
-		recipients: [...body.recipients.map((x) => new Recipient({ user_id: x })), new Recipient({ user_id: req.user_id })]
-	}).save();
-
-	await emitEvent({ event: "CHANNEL_CREATE", data: channel, user_id: req.user_id } as ChannelCreateEvent);
-
-	res.json(channel);
+	res.json(await ChannelService.createDMChannel(body.recipients, req.user_id, body.name));
 });
 
 export default router;
diff --git a/api/src/routes/users/@me/relationships.ts b/api/src/routes/users/@me/relationships.ts
index 58d2e481..1d72f11a 100644
--- a/api/src/routes/users/@me/relationships.ts
+++ b/api/src/routes/users/@me/relationships.ts
@@ -18,9 +18,19 @@ const router = Router();
 const userProjection: (keyof User)[] = ["relationships", ...PublicUserProjection];
 
 router.get("/", route({}), async (req: Request, res: Response) => {
-	const user = await User.findOneOrFail({ where: { id: req.user_id }, relations: ["relationships"] });
+	const user = await User.findOneOrFail({ where: { id: req.user_id }, relations: ["relationships", "relationships.to"] });
+
+	//TODO DTO
+	const related_users = user.relationships.map(r => {
+		return {
+			id: r.to.id,
+			type: r.type,
+			nickname: null,
+			user: r.to.toPublicUser(),
+		}
+	})
 
-	return res.json(user.relationships);
+	return res.json(related_users);
 });
 
 export interface RelationshipPutSchema {
@@ -48,7 +58,10 @@ router.post("/", route({ body: "RelationshipPostSchema" }), async (req: Request,
 		await User.findOneOrFail({
 			relations: ["relationships", "relationships.to"],
 			select: userProjection,
-			where: req.body as { discriminator: string; username: string }
+			where: {
+				discriminator: String(req.body.discriminator,).padStart(4, '0'), //Discord send the discriminator as integer, we need to add leading zeroes
+				username: req.body.username
+			}
 		}),
 		req.body.type
 	);