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

Added Facility Cover image API endpoints #791

Merged
merged 7 commits into from
Jul 25, 2022

Conversation

Marmik2003
Copy link
Contributor

fixes #737

@Marmik2003 Marmik2003 requested a review from a team as a code owner May 27, 2022 06:11
Copy link
Member

@vigneshhari vigneshhari left a comment

Choose a reason for hiding this comment

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

Changes requested in Initial Review.

config/settings/local.py Outdated Show resolved Hide resolved
config/settings/base.py Show resolved Hide resolved
care/utils/csp/config.py Show resolved Hide resolved
care/facility/api/viewsets/facility.py Outdated Show resolved Hide resolved
care/facility/api/viewsets/facility.py Outdated Show resolved Hide resolved
care/facility/api/viewsets/facility.py Show resolved Hide resolved
care/facility/api/serializers/facility.py Outdated Show resolved Hide resolved
care/facility/api/serializers/facility.py Outdated Show resolved Hide resolved
Key=f"cover_images/{image.name}",
Body=image.file,
)
facility.cover_image_url = f"{upload_response['ResponseMetadata']['HTTPHeaders']['location']}cover_images/{image.name}"
Copy link
Member

Choose a reason for hiding this comment

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

Ideally we want to store the key and store the CDN URL separately, we can ignore this for this instance i think.

care/facility/api/viewsets/facility.py Outdated Show resolved Hide resolved


class FacilityImageUploadSerializer(serializers.ModelSerializer):
cover_image = serializers.ImageField(required=True, write_only=True)
Copy link
Member

Choose a reason for hiding this comment

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

why is this write_only, there is not retrieve API associated to this endpoint right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no retrieve API with upload serializer, that's why I'm making it write-only, cover_image_url will be there on facility retrieve API endpoint, am I going in right direction?

care/facility/api/serializers/facility.py Outdated Show resolved Hide resolved
@vigneshhari
Copy link
Member

Changes look good to me otherwise, @mathew-alex add env vars for the extra setting confs required in this PR.

@mathew-alex
Copy link
Contributor

Changes look good to me otherwise, @mathew-alex add env vars for the extra setting confs required in this PR.

added env vars in staging.

@vigneshhari
Copy link
Member

@mathew-alex can we merge this PR ?

@gigincg
Copy link
Member

gigincg commented Jul 25, 2022

@mathew-alex Add the ENV requirements in the Deploy Docs as well.

@Marmik2003 Can you fix the conflicts

@vigneshhari Let's merge this!

@sonarcloud
Copy link

sonarcloud bot commented Jul 25, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vigneshhari vigneshhari merged commit a214221 into ohcnetwork:master Jul 25, 2022
@sainak
Copy link
Member

sainak commented Jul 27, 2022

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.

Facility Image
5 participants