Skip to content

feat: add template version creator #2991

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

Merged
merged 3 commits into from
Jul 14, 2022

Conversation

AbhineetJain
Copy link
Contributor

@AbhineetJain AbhineetJain commented Jul 14, 2022

This PR adds a created_by field to the template version table and returns the relevant data with the API calls.

Subtasks

  • add a created_by field to the template version table
  • populate the default value of the field from the created_by field from the corresponding template
  • populate the field on insertion
  • return the field via the API

This will enable us to show the template version history (who created it and when) on the Template page for #2876.

Example API Call

Request

http://localhost:8080/api/v2/templateversions/be409505-f1cd-40ac-8c2d-364c27469681

Response

{
    "id": "be409505-f1cd-40ac-8c2d-364c27469681",
    "template_id": "790457b4-bd93-43dc-9c76-cf43c7251448",
    "organization_id": "8668a031-d228-4773-abb2-bc8ac2f39716",
    "created_at": "2022-07-14T16:43:45.993399969Z",
    "updated_at": "0001-01-01T00:00:00Z",
    "name": "elastic_leavitt4",
    "job": {
        "id": "bd08dbcf-5274-49b7-bfe5-a1c4ee259cd5",
        "created_at": "2022-07-14T16:43:45.993396474Z",
        "started_at": "2022-07-14T16:43:46.172760057Z",
        "completed_at": "2022-07-14T16:43:52.543660466Z",
        "status": "succeeded",
        "worker_id": "3f74d616-df83-4557-9fd0-d31a863ed0d8",
        "storage_source": "6c621616837cca443cf54c9445c8986527e24ee12a09c3c51ffa98c3abf743be"
    },
    "readme": "---\nname: Develop code-server in Docker\ndescription: Run code-server in a Docker development environment\ntags: [local, docker]\n---\n\n# code-server in Docker\n\n## Getting started\n\nRun `coder templates init` and select this template. Follow the instructions that appear.\n\n## Supported Parameters\n\nYou can create a file containing parameters and pass the argument\n`--parameter-file` to `coder templates create`.\nSee `params.sample.yaml` for more information.\n\nThis template has the following predefined parameters:\n\n- `docker_host`: Path to (or address of) the Docker socket.\n  \u003e You can determine the correct value for this by runnning\n  \u003e `docker context ls`.\n- `docker_arch`: Architecture of the host running Docker.\n  This can be `amd64`, `arm64`, or `armv7`.\n",
    "created_by_id": "6d17ede3-bf5d-4bb9-b1c3-5dbcf8cfc13a",
    "created_by_name": "admin"
}

@AbhineetJain AbhineetJain requested a review from a team as a code owner July 14, 2022 16:50
@AbhineetJain AbhineetJain requested a review from a team July 14, 2022 16:55
Copy link
Member

@Kira-Pilot Kira-Pilot left a comment

Choose a reason for hiding this comment

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

FE ✅

@AbhineetJain AbhineetJain enabled auto-merge (squash) July 14, 2022 20:36
@AbhineetJain AbhineetJain merged commit aea3b3b into main Jul 14, 2022
@AbhineetJain AbhineetJain deleted the abhineetjain/2876-add-template-version-creator branch July 14, 2022 20:44
coadler added a commit that referenced this pull request Jul 14, 2022
coadler added a commit that referenced this pull request Jul 14, 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.

3 participants