-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
182 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
#[derive(Debug, PartialEq)] | ||
pub enum Error { | ||
ParseError(std::num::ParseIntError), | ||
use thiserror::Error; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum CoreError { | ||
#[error("parse error {0}")] | ||
ParseError(#[from] std::num::ParseIntError), | ||
|
||
#[error("io error {0}")] | ||
IOError(#[from] std::io::Error), | ||
|
||
#[error("missing parameters")] | ||
MissingParameters, | ||
#[error("not found")] | ||
NotFound, | ||
#[error("transparent")] | ||
InternalError, | ||
#[error("unknown data store error")] | ||
Unknown, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
use async_trait::async_trait; | ||
|
||
use crate::common::errors::Error; | ||
use crate::common::errors::CoreError; | ||
use crate::entities::question::{QuestionEntity, QuestionId}; | ||
use crate::entities::question_filter::QuestionFilter; | ||
|
||
use async_trait::async_trait; | ||
|
||
#[async_trait] | ||
pub trait QuestionPort { | ||
async fn add(&self, question: QuestionEntity) -> Result<QuestionEntity, Error>; | ||
async fn update(&self, question: QuestionEntity) -> Result<QuestionEntity, Error>; | ||
async fn delete(&self, question_id: &QuestionId) -> Result<(), Error>; | ||
async fn get(&self, question_id: &QuestionId) -> Result<QuestionEntity, Error>; | ||
async fn list(&self, question_filter: &QuestionFilter) -> Result<Vec<QuestionEntity>, Error>; | ||
async fn add(&self, question: QuestionEntity) -> Result<QuestionEntity, CoreError>; | ||
async fn update(&self, question: QuestionEntity) -> Result<QuestionEntity, CoreError>; | ||
async fn delete(&self, question_id: &QuestionId) -> Result<(), CoreError>; | ||
async fn get(&self, question_id: &QuestionId) -> Result<QuestionEntity, CoreError>; | ||
async fn list( | ||
&self, | ||
question_filter: &QuestionFilter, | ||
) -> Result<Vec<QuestionEntity>, CoreError>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.