-
Notifications
You must be signed in to change notification settings - Fork 83
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
[Vocabularies] Create new async Vocabularies resource, service & REST… #2816
Conversation
Not fully finished, I have a few points that I need to check (see FIXME). |
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.
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.
Model looks good to me, just a couple improvement suggestions
72e3733
to
cf49931
Compare
@MarkLark86 thanks for your feedbacks, I should have addressed all of them, let me know if it's fine now. |
- Moved to `vocabularies_async` and `types` to be consistent with `dev_async`. - Set `internal_resource` to the old resource. - Added `ResourceConfig`. - Added module to `default_settings`. - Addressed feedbacks.
cf49931
to
0f1edca
Compare
My resource doesn't appear in the client, I'm not sure why.
|
I'm guessing the client is using the home endpoint to get the list of endpoints, and using that. This endpoint is populated by eve. I will look into adding our async resources to that home endpoint. I will comment here once that's done
Helmy has just created a PR to add this functionality. For now, we can leave auth out of this resource until the auth rule PR is merged. |
@jerome-poisson I have updated your PR in your branch, to get the REST API working, along with a couple other fixes (like auth fix, cors headers and a couple issues in the model & service). It works locally, except I am unable to edit an existing CV. I haven't done thorough testing there, but looks like from the front-end it's trying to use POST instead of PATCH when updating an existing item. Can you please investigate and find a solution |
@MarkLark86 Sure, I'll investigate that. Thanks for your review and patches. |
update.unique_field = "qcode" | ||
|
||
unique_field = update.unique_field | ||
vocabs = {} | ||
if update.schema_ and update.items: | ||
if update.schema and update.items: |
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.
I did use schema_
because schema
is already used in ResourceModel
(it's coming from Pydantic's BaseModel
). With your change, I have that:
/home/goffi/dev/sourcefabric/venv/async_3.10/lib/python3.10/site-packages/pydantic/_internal/_fields.py:172: UserWarning: Field name "schema" in "VocabulariesResourceModel" shadows an attribute in parent "ResourceModel"
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.
I'm reverting to schema_
and using:
schema_: Annotated[dict[str, dict], Field(alias="schema")]
I still can't run the client at all, I have this message in JS console:
And I can't even log in (in fact, I don't have logging screen at all). If you could run the frontend with this PR I must have something wrong in my config or something, I'm investigating. |
@@ -414,6 +416,24 @@ def setup_sentry(self): | |||
|
|||
sentry_sdk.init(dsn=self.config["SENTRY_DSN"], integrations=[QuartIntegration(), AsyncioIntegration()]) | |||
|
|||
def extend_eve_home_endpoint(self, links: list[dict]) -> None: |
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.
This method is never called.
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.
You'll need to grab latest eve lib (from our superdesk/eve/Async repo & branch)
@MarkLark86 the client is using a wrong HTTP verb due to the |
|
… API.
SDESK-7468