Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to camel case views #7

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/auth/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ use serde::{Deserialize, Serialize};
use utoipa::ToSchema;

#[derive(Deserialize, Serialize, ToSchema, Clone)]
#[serde(rename_all = "camelCase")]
pub struct LoginRequest {
#[schema(example = "[email protected]")]
pub email: String,
pub password: String,
}

#[derive(Deserialize, Serialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct TokenView {
pub user_id: i32,
pub access_token: String,
Expand Down
1 change: 1 addition & 0 deletions src/common/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use thiserror::Error;
use utoipa::ToSchema;

#[derive(Serialize, Error, Debug, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ApiError {
status_code: u16,
errors: Vec<String>,
Expand Down
3 changes: 3 additions & 0 deletions src/todo/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use utoipa::ToSchema;
use crate::todo::models::Todo;

#[derive(sqlx::FromRow, Deserialize, Serialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct TodoView {
pub id: i32,
pub title: String,
Expand All @@ -27,12 +28,14 @@ impl From<Todo> for TodoView {
}

#[derive(sqlx::FromRow, Deserialize, Serialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct NewTodoRequest {
pub title: String,
pub description: String,
}

#[derive(sqlx::FromRow, Deserialize, Serialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct EditTodoRequest {
pub title: String,
pub description: String,
Expand Down
2 changes: 2 additions & 0 deletions src/user/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use utoipa::ToSchema;
use crate::user::models::User;

#[derive(sqlx::FromRow, Deserialize, Serialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct UserView {
pub id: i32,
#[schema(example = "[email protected]")]
Expand All @@ -22,6 +23,7 @@ impl From<User> for UserView {
}

#[derive(sqlx::FromRow, Deserialize, Serialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct NewUserRequest {
#[schema(example = "[email protected]")]
pub email: String,
Expand Down
Loading