Przeglądaj źródła

Add user schema to docs

Lee Morgan 1 miesiąc temu
rodzic
commit
7909410868

+ 16 - 0
docs/components/schemas/user.yaml

@@ -0,0 +1,16 @@
+type: object
+properties:
+  id:
+    type: string
+    format: uuid
+    description: Unique ID of the user
+    example: 019e5a61-2977-773c-aeb4-d9be192ec0c4
+  name:
+    type: string
+    description: Name of the user
+    example: John Smith
+  email:
+    type: string
+    format: email
+    description: email of the user
+    example: john.smith@mail.com

+ 17 - 0
docs/openapi.yaml

@@ -0,0 +1,17 @@
+openapi: 3.0.4
+info:
+  title: API Documentation | ChatRPG
+  version: 1.0.0
+  description: API fro ChatRPG
+
+servers:
+  - url: http://localhost:8000
+    description: Development/local server
+
+tags:
+   - name: User
+
+components:
+  schemas:
+    User:
+      $ref: "./components/schemas/user.yaml"

+ 0 - 0
src/controllers/user/get_one.rs


+ 1 - 1
src/models/user.rs

@@ -34,7 +34,7 @@ impl User {
 
     pub async fn insert_one(&self, db: &PgPool) -> Result<(), HttpError> {
         let result = sqlx::query(
-            "INSERT into users(id, token, name, email, pass_hash, created_at),
+            "INSERT into users(id, token, name, email, pass_hash, created_at)
             VALUES($1, $2, $3, $4, $5, $6)"
         )
             .bind(&self.id)