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

Refactorization for run_existing end-point #1267

Merged
merged 14 commits into from
Apr 10, 2024
Merged

Refactorization for run_existing end-point #1267

merged 14 commits into from
Apr 10, 2024

Conversation

Tansito
Copy link
Member

@Tansito Tansito commented Mar 28, 2024

Summary

Continuing with #1240 and #1243 this is a proposal to move views and services logic to serializers.

The idea behind this refactorization is:

  • Use more serializers in the different views
  • Concentrate the access to the models in the serializers
  • We move from a non-standard class: service, to a first-class member for DRF: serializers

This PR concentrates the work in the run_existing end-point.

Details and comments

  • Two new serializers are created:
    • RunExistingProgramSerializer: it will manage the input from the request for the rest of the logic
    • RunExistingJobSerializer: specific logic for Job in this end-point.
  • Models optimization:
    • Field created is not editable
    • Fixed __str__ method in JobConfig model
    • Fixed default value for Job.status. We were using QUEUE by default.

The rest changes are minor fixes:

@Tansito
Copy link
Member Author

Tansito commented Mar 28, 2024

I didn't remove services or review if I can reuse a serializer in other end-point just to avoid to add more changes to the PR. Probably in the run end-point PR I'm going to be able to reuse some serializers but I will take a look later on.

@Tansito Tansito marked this pull request as ready for review March 29, 2024 15:12
@Tansito Tansito changed the title 🏗️ Refactorization for run_existing end-point Refactorization for run_existing end-point Mar 29, 2024
Copy link
Member

@IceKhan13 IceKhan13 left a comment

Choose a reason for hiding this comment

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

Looks clean! let's give it a go

# Conflicts:
#	gateway/api/serializers.py
#	gateway/api/views.py
@Tansito Tansito merged commit 10f6b19 into main Apr 10, 2024
14 checks passed
@Tansito Tansito deleted the run_refactorization branch April 10, 2024 14:39
@Tansito Tansito mentioned this pull request Apr 15, 2024
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.

3 participants