Skip to content

Core functionality to allow a hiring manager to add applicant to CATS

Aditya Athalye requested to merge feature/hiring-mgr-add-applicant into master

This PR is meant to add this story: https://www.pivotaltracker.com/story/show/173413601

Note: Please do not squash commits on merge. The commit history is carefully constructed, to be of pedagogical value. It will help teach other people later.

Acceptance Criteria

x-post from the story:

On making a call to the add-applications API with an applicant payload, we get an id back. We should be able to make a call to the get-application API with this id to fetch the same payload.

Tests

Clojure tests are available for cats.models. We decided to punt handler tests for next time.

Additionally, a bash script is available to smoke test (with curl requests). One may use it as follows:

  • Ensure postgres is up and running locally (or else start it)

    $ sudo service postgresql status  # PG version must be >= 10.0.0
  • Ensure you have 'cats_dev' db, with the right config, and tables:

    • A 'resources/secrets.edn' file with PG user/pass for your development environment (see also, 'resources/config.edn'):

      {:postgres-dev-user "FIXME"
       :postgres-dev-password "FIXME"}
    • 'applications' table created according to resources/migrations (see also, cats.db.migrations ns)

      cats_dev=> \d applications
                                Table "public.applications"
           Column      |           Type           | Collation | Nullable | Default 
      -----------------+--------------------------+-----------+----------+---------
       id              | uuid                     |           | not null | 
       applicant_name  | text                     |           | not null | 
       email           | text                     |           | not null | 
       phone           | text                     |           | not null | 
       created_at      | timestamp with time zone |           |          | 
       description     | text                     |           |          | 
       resume          | bytea                    |           |          | 
       resume_filename | text                     |           |          | 
      Indexes:
          "applications_pkey" PRIMARY KEY, btree (id)
      Check constraints:
          "resume_filename_iff_resume" CHECK (resume_filename IS NULL AND resume IS NULL OR resume_filename IS NOT NULL AND resume IS NOT NULL)
  • Start a ring server, at the project root:

    $ lein ring server # the server will listen on port 3000
  • Call the Bash script, from the project root, with the server port no.:

    $ bin/curl-tests.sh 3000   # hit enter
  • If you see output like this, it means the add and get application routes are working, with a real DB.

    ===About to perform various hiring manager actions.===
    
    ===POST New application record===
    {
      "id": "7d74dba3-a149-471e-a3b2-4bca8d5b9d1a"
    }
    
    ===GET existing application record===
    {
      "applicants/id": "7d74dba3-a149-471e-a3b2-4bca8d5b9d1a",
      "applicants/applicant_name": "Culrd Applicant 7433",
      "applicants/email": "curldapp7433@example.com",
      "applicants/phone": "9876543210",
      "applicants/created_at": "2020-07-20T12:33:01Z",
      "applicants/description": "Curl was used to add this \"Curld Applicant 7433\" person.",
      "applicants/resume_filename": "resume.pdf"
    }
      
    ===Finished running tests.===
Edited by Aditya Athalye

Merge request reports