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

Add AppSessionId #793

Merged
merged 46 commits into from
Nov 24, 2020
Merged

Add AppSessionId #793

merged 46 commits into from
Nov 24, 2020

Conversation

nieznanysprawiciel
Copy link
Contributor

@nieznanysprawiciel nieznanysprawiciel commented Nov 17, 2020

  • Event API - Agreement events
  • Add AppSessionId

resolves: #726

Contains changes from: #754
which resolves: #729

…ocedural macro for generating ToSql/FromSql implementation
@nieznanysprawiciel nieznanysprawiciel changed the base branch from master to market/agreement-events November 17, 2020 13:30
@nieznanysprawiciel nieznanysprawiciel removed request for a team and prekucki November 19, 2020 14:44
Copy link
Contributor

@tworec tworec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

part 1

core/market/src/db/dao.rs Outdated Show resolved Hide resolved
core/market/src/db/dao/agreement.rs Show resolved Hide resolved
core/market/src/db/dao/agreement.rs Outdated Show resolved Hide resolved
core/market/src/db/dao/agreement_events.rs Outdated Show resolved Hide resolved

use crate::db::model::{OwnerType, Proposal, ProposalId, SubscriptionId};
use crate::db::schema::market_agreement;

pub type AgreementId = ProposalId;
pub type AppSessionId = Option<String>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as this is user input, we need to check if this is at most 100 chars. Is there a unit test for such a case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know, we have such a limit. Is it documented?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have implicitly set this limit via up.sql ;)

core/market/src/db/model/agreement.rs Outdated Show resolved Hide resolved
Comment on lines +59 to +62
log::warn!(
"Agreement Event with not parsable Reason in database. Error: {}. Shouldn't happen \
because market is responsible for rejecting invalid Reasons.", e
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: I'd also return this warning mesage as a proper JsonReason for the clients to be aware and can report if it happens one day

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean, that you would set this error message in JsonResponse?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, and extend this message to contain whole reason contents

Cargo.toml Show resolved Hide resolved
Copy link
Contributor

@tworec tworec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uhh, it was big. But here it is

core/market/src/db/model/proposal_id.rs Show resolved Hide resolved
core/market/src/negotiation/common.rs Outdated Show resolved Hide resolved
core/market/src/utils/display.rs Outdated Show resolved Hide resolved
core/market/src/market.rs Outdated Show resolved Hide resolved
core/market/src/rest_api.rs Outdated Show resolved Hide resolved
core/market/tests/test_app_session_id.rs Outdated Show resolved Hide resolved
core/market/tests/test_app_session_id.rs Show resolved Hide resolved
core/market/tests/test_app_session_id.rs Outdated Show resolved Hide resolved
core/market/tests/test_app_session_id.rs Show resolved Hide resolved
core/market/tests/test_app_session_id.rs Show resolved Hide resolved
Wiezzel
Wiezzel previously approved these changes Nov 23, 2020
@nieznanysprawiciel nieznanysprawiciel dismissed stale reviews from Wiezzel via 7e0b5d4 November 23, 2020 11:35
Co-authored-by: Piotr Chromiec <tworec@golem.network>
core/market/src/negotiation/common.rs Show resolved Hide resolved
const DEFAULT_EVENT_TIMEOUT: f32 = 0.0; // seconds
const DEFAULT_QUERY_TIMEOUT: f32 = 12.0;
const DEFAULT_EVENT_TIMEOUT: f32 = 5.0; // seconds
const DEFAULT_QUERY_TIMEOUT: f32 = 5.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

below you can find examlpe how to handle invalid user input for appSessionId ie. len > 100 chars in this case

core/market/tests/test_app_session_id.rs Show resolved Hide resolved
@nieznanysprawiciel nieznanysprawiciel merged commit 966e9ea into master Nov 24, 2020
@nieznanysprawiciel nieznanysprawiciel deleted the market/add-app-session-id branch November 24, 2020 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Endpoint for Agreement Events Add appSessionId to market service endpoints
3 participants