1
0
mirror of https://github.com/actix/examples synced 2024-11-23 22:41:07 +01:00

Fix small issues in juniper-advanced example (#673)

Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
Pete Doherty 2023-12-11 01:54:22 -05:00 committed by GitHub
parent c648953b23
commit c34afd32fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -30,7 +30,7 @@ CREATE TABLE `product` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `product_fk0` (`user_id`), KEY `product_fk0` (`user_id`),
CONSTRAINT `product_fk0` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) CONSTRAINT `product_fk0` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; ) ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
-- --
@ -55,7 +55,7 @@ CREATE TABLE `user` (
`email` varchar(255) NOT NULL, `email` varchar(255) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`) UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; ) ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
-- --

View File

@ -51,7 +51,7 @@ impl QueryRoot {
Ok(User { id, name, email }) Ok(User { id, name, email })
} }
#[graphql(description = "List of all users")] #[graphql(description = "List of all products")]
fn products(context: &Context) -> FieldResult<Vec<Product>> { fn products(context: &Context) -> FieldResult<Vec<Product>> {
let mut conn = context.db_pool.get().unwrap(); let mut conn = context.db_pool.get().unwrap();
@ -65,7 +65,7 @@ impl QueryRoot {
Ok(products) Ok(products)
} }
#[graphql(description = "Get Single user reference by user ID")] #[graphql(description = "Get Single product reference by product ID")]
fn product(context: &Context, id: String) -> FieldResult<Product> { fn product(context: &Context, id: String) -> FieldResult<Product> {
let mut conn = context.db_pool.get().unwrap(); let mut conn = context.db_pool.get().unwrap();
let product: Result<Option<Row>, DBError> = let product: Result<Option<Row>, DBError> =