visevol / GithubVisualisation

PFE028 Été 2024
MIT License
0 stars 1 forks source link

[Backend] add an endpoint to get information about a specific source file #41

Open zergov opened 5 days ago

zergov commented 5 days ago

Let's add an endpoint that returns the summary of a file. Example:

Schema: /repositories/:repository_id/files/head/:filepath
---
GET /repositories/123/files/head/actionview/lib/action_view/renderer/renderer.rb

We can push this even further to checkout information about the file at a specific revision. Example:

GET /repositories/123/files/592ea10f8b7d410544b22a4c70dc1fa477458556/activerecord/test/support/async_helper.rb

The output could look like:

{
  filepath: "activerecord/test/support/async_helper.rb"
  file_type: "ruby",
  file_categories: [
    "source",
  ]
  commit_count: 2,
  main_contributor: "Jean Boussier",
  line_count: 15,
  size: 422,
  created_at: "2021-01-04",
  last_modified: "2023-11-29",
  remote_link: "https://github.com/rails/rails/blob/main/activerecord/test/support/async_helper.rb",
}

This can be used to power a view that looks like this: image