aalug / job-finder-go Goto Github PK
View Code? Open in Web Editor NEWJob Finder REST API built with Go and Gin.
Job Finder REST API built with Go and Gin.
Add get user API.
This is basic and quite uncomplicated function but its needed for example for getting profile details before updating.
Test the function.
Create a new table called employers with columns such as:
The company_id column would be a foreign key referencing the id column in the companies table. This would allow to associate an employer with a company.
Then add functionality to allow these employers to create jobs and job skills. This could involve inserting rows into the jobs and job_skills tables, respectively.
Update (or create if they don't exist) tests for config, utils, and token packages.
A few simple functions are not fully tested, fix that.
Create job applications table and functions for handling CRUD operations.
This table should have job_id
, user_id
, message
, and cv
fields.
Every user should be allowed to create just one application for one job - create a unique constraint.
Using the sqlc generate functions to create, update, delete, get, and list jobs for employers and users (different details should be returned)
Test all functions.
Add delete employer API.
Add a function to handle DELETE requests and delete the employer's company and the employer itself.
Test the function.
Add get job application for user API.
It should handle GET requests and return data specified for the user (already exists specific database db function) if the user is authenticated and is the applicant/ owner of the application.
For now, the cv will be in []byte
format, later file server will be created and the cv hosted there.
Test the function.
Add update user password API.
Create a function to handle changing passwords.
The request body should contain:
The function has to check if the old password from the request body is the same as user.HashedPassword
,
if it is, then new password should be hashed and set as as new password.
Generate functions for CRUD operations with sqlc for the users table.
Test functions.
Restructure the project.
Change the structure of the project to use the standard go project structure (cmd, internal, pkg).
Move:
config.go
file from utils to allow utils to go to the pkg
)packages to the internal
folder.
Move:
packages to the pkg
folder.
Move the main.go
file to cmd
folder.
Update all imports and fix all bugs that were caused but these changes.
Add delete user API.
It should allow users to delete their accounts.
First, delete all user skills, then delete the user that has made the request.
Add automatic deleting jobs indexes after job was deleted.
Create a function to handle deleting of index documents.
Implement this function in the function that handles delet job API.
Update the tests.
Enhancing Job Creation Process with Elasticsearch Indexing
Add functionality to createJob
function for it to create jobs index afret new job is created.
To accomplish this, new esearch
function will be required. It should create just one index for just one job.
Update function tests.
Create SQL store and add transactions to handle multiple job and user skills.
These functions should accept as arguments slices of data required to create a job skill and user skill, and using existing functions to create skills, create all of them.
Using sqlc add functions to delete multiple job and user skills and to delete all skills of a specific job.
Setup elasticsearch, create:
Implement user login:
Add auth middleware that to protect routes.
It should check if the user is authenticated and if not - restrict from calling an endpoint.
Add create user API.
It should handle POST requests and create users.
The function should validate data, hash the password, create a user, and create user_skills for the user.
Mock the store and test the function.
Add create job application API.
It should handle receiving:
string
, optional)int32
, required)multipart.File
, required)It should validate received data and if everything is valid, create db.JobApplication
with default status - Applied.
Test the function.
Generate functions for CRUD operations with sqlc for the jobs table.
Additionaly add functions to list jobs by miltiple fields:
Create a function to search for jobs using Elasticsearch.
The function should take two parameters:
It should perform elasticsearch search to get jobs with the same or similar:
It should return a slice of jobs which later will be used to handle API requests.
Add get employer API.
It should return information about the logged-in employer and it's company.
Test the function.
Write an initial database schema in Postgres.
Use golang-migrate to run migrations.
This schema should contain tables such as:
Generate functions for CRUD operations with sqlc for the job_skills table.
Test functions.
Create a function that queries the jobs index by document ID.
For now this will be a helper function for testing purposes.
Generate functions for CRUD operations with sqlc for the user_skills table.
Test functions.
Update the job_test
file, and test ListJobsMatchingUserSkills
function (it required job_skills and user_skills to test it)
Add get job application for employer API.
It should handle GET requests and return data specified for the employer (already exists specific database function) if the employer is authenticated and is part of the company that owns this job posting (employer.CompanyID == companyID
, where companyID
was got by another db function that gets companyID by JobID)
For now, the cv will be in []byte format, later file server will be created and the cv hosted there.
Test the function.
Add list jobs by matching user skills API.
Create a function to handle GET requests with query parameters (page number and page size) that for authenticated users will return array of jobs that match their skills.
Test the function.
Add restrictions to deleting job skills.
Add to functions that delete job skills a check that will allow deleting of job skills only if the employer making the request is the author of these skills.
Add get job details API.
Make changes to the GetJob
query (function generated by sqlc) to select not only the job but also company and employer informations. This endpoint should receive in the url an id of a job and get all needed details.
This function should not return job skills - this sould be handled by another function to allow client to get paginated job skills.
Add search jobs API.
Create a function to handle GET requests with query parameters:
page
(page number)page_size
(number of jobs per page)search
(search query that will be passed to the esearch.SearchJobs
function)Validate the query (all 3 parameters should be required).
Call the esearch.SearchJobs
function with provided data.
Return received jobs in JSON format.
Handle job application unique constraint violation (userID, jobID).
There is a unique constraint in the database not to allow creating job applications where the job_id
and user_id
pair already exist.
Add a check for this case in the createJobApplication
handler.
Test this new functionality.
Add update user API.
It should allow authenticated users to update their account details.
Users should be able to update all data except the password. It will be handled with a different endpoint.
Test the function.
Add login employer API.
It will look almost like login user API - the basic principle is the same (get employer, check the password, return details)
Add update job posting API.
Create a function to handle PATCH requests that updates job and job skills.
There should be validation that will allow only job owners to make changes in a job and check the validity of the request body (similarly to the function that creates the job).
Add delete job API.
Create a function to handle deleting a job posting.
The function should check if the employer making the request is the owner of the job - if not, 401 status should be returned.
Test the function.
The API should accept the job details and a list of required skills in the request.
Upon receiving the request, the job will be created in the database. Upon successful creation of the job, the necessary skills will be created and assigned to the newly created job.
Test the functionality of this API.
Add list jobs by company API.
Create a function to handle GET requests that returns a list of jobs created by a specific company.
Query params:
and either:
or
or
The function should allow only one of those parameters and based on which one was provided call the appropriate database function.
Add create employer API.
Create a function to handle POST requests to create an employer.
To create an employer, a company ID is required, so the request should contain information for both of those objects, and the function should create them both.
Add API documentation using gin-swagger.
Add comments according to the schema to all API functions and generate swagger files.
Run swagger alongside other endpoints.
Add automatic indexing of jobs after job is created or updated.
Right now, indexes are created by calling one function that loads all jobs from the database and creates indexes. That is not very efficient. Create a function to index jobs after creation or update of a job object.
Add it to functions that handle API calls.
Add github actions to run all tests before merging branches.
Implement hashing passwords with bcrypt.
Create functions to:
Add CORS middleware to the setupRouter
function in the server.go
file to allow the frontend app to call this API.
gin-contrib/cors
Fix validation.ValidateEmail
function. For some reqson it says that email without a top-level domain (e.g. .com
) is valid (e.g. test@example)
Test the function.
Add filter and list jobs API.
Create a new SQL function to allow users to filter jobs by location, title, industry, and salary range.
It should all be done in one go.
Create a function to handle GET requests with query parameters (filters, page number, and page size).
Test the function.
Modify CORS middleware to accept authorization headers.
The rest of the CORS config should remain the same.
Add update employer password API.
Create a function to handle changing employer passwords.
The request body should contain:
The function has to check if the old password from the request body is the same as employer.HashedPassword
,
if it is, then new password should be hashed and set as as new password.
Generate functions for CRUD operations with sqlc for the companies table.
Test all functions.
Add update employer API.
It should allow authenticated employers to update their account and company details.
Employers should be able to update all data except the password. It will be handled with a different endpoint.
Test the function.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.