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

feat: add endpoint for getting data about a given document #81

Merged

Conversation

kaiiorg
Copy link
Contributor

@kaiiorg kaiiorg commented Dec 30, 2023

Related to #75

Adds endpoint at /api/cdn/doc/:filename that attempts to get relevant information for the requested document.

Example:
GET http://localhost:8080/api/cdn/doc/resume.pdf
returns

{
  "download_url": "localhost:8080/api/cdn/download/docs/resume.pdf",
  "file_size": 68403,
  "filename": "resume.pdf"
}

Confirmed the download_url works by pasting it in a web browser

I have not yet written any documentation for this endpoint yet. Wanted to get initial feedback first.

@kevinanielsen kevinanielsen added docs Improvements or additions to documentation api Improvements or additions to the api go Language: Go enhancement New feature or request and removed docs Improvements or additions to documentation labels Dec 30, 2023
@kevinanielsen
Copy link
Owner

Looks great so far! Documentation would be great!
If you could add tests for it, that would be amazing, but not necessary at all.

I'm going to assign you to the Issue

@kevinanielsen kevinanielsen linked an issue Dec 31, 2023 that may be closed by this pull request
@kevinanielsen kevinanielsen added the docs Improvements or additions to documentation label Dec 31, 2023
@kaiiorg
Copy link
Contributor Author

kaiiorg commented Dec 31, 2023

I've added the spec; I'll write some tests later today. Doesn't look like the project has any existing tests, am I correct?

@kaiiorg
Copy link
Contributor Author

kaiiorg commented Jan 1, 2024

Wrote tests covering every case except for when os.Stat fails for some reason other than the file not existing. Not sure how I'd force that to happen on demand.

@kaiiorg
Copy link
Contributor Author

kaiiorg commented Jan 1, 2024

I think this is ready for review, aside from maybe adding another make target and a github actions job to run the tests. I can do that if you'd like.

@kevinanielsen
Copy link
Owner

That would be amazing - I am struggling a bit with testing, as I am new to Go. Any contributions would be great! I will review you work for this issue now :)

Copy link
Owner

@kevinanielsen kevinanielsen left a comment

Choose a reason for hiding this comment

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

Looks great!

@kevinanielsen kevinanielsen merged commit c031982 into kevinanielsen:main Jan 2, 2024
1 check passed
@kaiiorg kaiiorg deleted the 75-add-endpoint-for-doc-metadata branch January 2, 2024 19:24
@kaiiorg
Copy link
Contributor Author

kaiiorg commented Jan 2, 2024

No problem on the testing; I'll open another issue for setting up the make target and github actions job and I'll work on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Improvements or additions to the api docs Improvements or additions to documentation enhancement New feature or request go Language: Go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Add endpoint for getting data about a given document
2 participants