-
Notifications
You must be signed in to change notification settings - Fork 2
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
Make api resources more beautiful #559
Conversation
@@ -318,7 +318,7 @@ | |||
} | |||
], | |||
'acceptable_blood_groups': [ | |||
'A', 0 | |||
'A', '0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tohle tam bylo schválně abychom si uměli poradit i s číslem když by to tak někdo náhodou poslal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Musim rict ze jsem trosku zmatenej z toho i z toho odkazu na PR #562 pisu nejaky otazky, pripadne si zavolejme.
@@ -53,7 +53,7 @@ | |||
RECIPIENTS = [ | |||
{ | |||
'acceptable_blood_groups': [ | |||
'A', 0 | |||
'A', '0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nechas tam teda aspon nekdy tu 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nebo to ted hezky nejde? Jako ve swaggeru to nevyzadujeme, je dulezity abychom zvladli jak 0 tak O ale nemusime asi zvladat int, to je mozna zbytecne obecny.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Níže v tomhle file tu 0 na několika místech nechávám
@@ -51,7 +51,8 @@ | |||
|
|||
RecipientJson = patient_api.model('Recipient', { | |||
'db_id': fields.Integer(required=True, description='Database id of the patient'), | |||
'acceptable_blood_groups': fields.List(required=False, cls_or_instance=fields.Nested(BloodGroupEnumJson)), | |||
'acceptable_blood_groups': fields.List(required=False, cls_or_instance=fields.Nested(BloodGroupEnumJson), | |||
example=['A', '0']), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ten example asi je hezci delat pres blood group enum ne?
@@ -69,4 +59,5 @@ def post(self, txm_event_id: int) -> str: | |||
:configuration.max_matchings_to_show_to_viewer] | |||
calculated_matchings_dto.show_not_all_matchings_found = False | |||
logging.debug('Collected matchings and sending them') | |||
return jsonify(calculated_matchings_dto) | |||
dataclasses.asdict(calculated_matchings_dto) | |||
return response_ok(calculated_matchings_dto) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to dataclasses tam davat nemusis ne? V response ok volas jsonify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dataclasses jsem tam zapomněl z testování. Ano, v response ok je jsonify a může se to v budoucnu nahradit tím marshalling.
def response_ok(data, code=200):
return make_response(jsonify(data), code)
@@ -30,7 +30,7 @@ | |||
} | |||
}, | |||
"200": { | |||
"description": "Success.", | |||
"description": "Success", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proc tady mazes tu .?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protože jsem odstranil description='Success.'
a 'Success' je zřejmě nějaká default hodnota flasku. Mít description Success u response_ok mi připadá zbytečné.
|
||
def response_error_matching_not_found(self): | ||
model = self._create_fail_response_model() | ||
return self.response(code=404, model=model, description='Matching for provided id was not found.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nemame ted nastaveny ten kod na nekolika mistech? Vzdy tohle jsme nejak meli reseny v tom hladnlovani erroriu?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tohle je to, co jsme měli napsané u každé routy a je to jen kvůli dokumentaci swaggeru.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
me tenhle kod mate cely ten soubor namespaces, kdyz mame jeste error_handler.py kterej taky nejak probublava do swaggeru, mam pocit ze je tady divna duplicita. Muzem si zavolat dyztak.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jak jsme se domluvili na callu, vytvořil jsem na tohle issue #590
Chapu PR #562 spravne tak, ze jsi tady vypnul nejaky testy a zas se maji zapnout v tamtom PR? |
…ces_more_beautiful # Conflicts: # txmatching/web/swagger/swagger.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASi ok takto
…ces_more_beautiful
Closes #500