Delete poll with vote adapter#3590
Conversation
vkrasnovyd
commented
May 21, 2026
- Instead of calling the internal action, send request to the vote_service to delete the poll;
- Skip deletion of the models from collections managed by vote service on cascade delete. They will be handled here along with the poll: https://github.com/OpenSlides/openslides-vote-service/blob/e1140fec06bc92b08e36a87516d6688c0c73379c/vote/vote.go#L548-L555;
- A bit of cleanup.
8bc64bf to
7214f77
Compare
luisa-beerboom
left a comment
There was a problem hiding this comment.
From my understanding this isn't done, which is why I won't complain about the user_merge test yet.
| def make_request( | ||
| self, | ||
| endpoint: str, | ||
| request_method: Literal["post", "delete"], |
There was a problem hiding this comment.
How about turning this into a type or StrEnum?
There was a problem hiding this comment.
Good idea. Added REQUEST_METHOD type with currently only 2 methods that are being used in the code.
| instance = datastore.get( | ||
| config_fqid, | ||
| list(get_fields_for_export(collection)), | ||
| config_ids = [poll.get("config_id") for poll in polls.values()] |
There was a problem hiding this comment.
If you are going to move this outside the if-clause, you might want to ensure polls is set by adding a default, or move this back
There was a problem hiding this comment.
Reverted this part. Was part of some work in progress changes that don't even belong here.
| config_ids = [poll.get("config_id") for poll in polls.values()] | ||
|
|
||
| for config_fqid in config_ids: | ||
| collection, id_ = config_fqid.split("/") |
There was a problem hiding this comment.
I can see that this is not your code so this is just a suggestion, but you could use collection_and_id_from_fqid here
user_merge needs to be discussed and more seriously updated because of the changes that have happened in the collections. I will handle user_merge and tests for it separately. |
This reverts commit df3a322.
d51a325 to
2456925
Compare
| self, | ||
| endpoint: str, | ||
| request_method: Literal["post", "delete"], | ||
| request_method: Literal[REQUEST_METHOD.POST, REQUEST_METHOD.DELETE], |
There was a problem hiding this comment.
Can't you just write request_method: REQUEST_METHOD,?
There was a problem hiding this comment.
Doing this with the StrEnum-class shared for all the services seems to be not safe to me (in case we ever have to update it). As we didn't need it for other services, moved it to the file with VoteAdapter and made the suggested change.
| from enum import StrEnum | ||
|
|
||
|
|
||
| class REQUEST_METHOD(StrEnum): |
There was a problem hiding this comment.
I think RequestMethod may be a better name. We don't usually fully capitalize StrEnums.