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

create database documentation (#152) #153

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,22 @@ Search functionality is implemented both with Postgres and Elasticsearch (depend
- use standard `go test` commands (e.g. `go test -v ./internal/api`)
<hr>

## Database
The database's schema and intricate details can be found on dedicated webpage, which provides a comprehensive
overview of the data structure, tables, relationships, and other essential information. To explore the database
further, please visit this [dbdocs.io webpage](https://dbdocs.io/aalug/go_job_search) Password: `jobsearchsecret`


<hr>

## API endpoints
This API provides a set of endpoints for managing:
- users
- employers
- jobs
- job applications

(and indirectly: user skills, job skills and verify emails table)
(and indirectly: user skills, job skills and verify emails tables)


After running the server, the Swagger documentation is available at http://localhost:8080/swagger/index.html.
Expand Down
111 changes: 111 additions & 0 deletions docs/db.dbml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
Enum "application_status" {
"Applied"
"Seen"
"Interviewing"
"Offered"
"Rejected"
}

Table "companies" {
"id" SERIAL [pk, increment]
"name" TEXT [not null]
"industry" TEXT [not null]
"location" TEXT [not null]

Indexes {
name [name: "idx_companies_name"]
}
}

Table "jobs" {
"id" SERIAL [pk, increment]
"title" TEXT [not null]
"industry" TEXT [not null]
"company_id" INTEGER [not null]
"description" TEXT [not null]
"location" TEXT [not null]
"salary_min" INTEGER [not null]
"salary_max" INTEGER [not null]
"requirements" TEXT [not null]
"created_at" timestamptz [not null, default: `NOW()`]

Indexes {
title [name: "idx_jobs_title"]
location [name: "idx_jobs_location"]
industry [name: "idx_jobs_industry"]
(salary_min, salary_max) [name: "idx_jobs_salary_range"]
created_at [name: "idx_jobs_created_at"]
}
}

Table "users" {
"id" SERIAL [pk, increment]
"full_name" TEXT [not null]
"email" TEXT [not null]
"hashed_password" TEXT [not null]
"location" TEXT [not null]
"desired_job_title" TEXT [not null]
"desired_industry" TEXT [not null]
"desired_salary_min" INTEGER [not null]
"desired_salary_max" INTEGER [not null]
"skills" TEXT [not null]
"experience" TEXT [not null]
"created_at" timestamptz [not null, default: `NOW()`]

Indexes {
email [name: "idx_users_email"]
}
}

Table "job_skills" {
"id" SERIAL [pk, increment]
"job_id" INTEGER [not null]
"skill" TEXT [not null]
}

Table "user_skills" {
"id" SERIAL [pk, increment]
"user_id" INTEGER [not null]
"skill" TEXT [not null]
"experience" INTEGER [not null]
}

Table "employers" {
"id" SERIAL [pk, increment]
"company_id" INTEGER [not null]
"full_name" TEXT [not null]
"email" TEXT [unique, not null]
"hashed_password" TEXT [not null]
"created_at" timestamptz [not null, default: `NOW()`]

Indexes {
email [name: "employers_email_idx"]
}
}

Table "job_applications" {
"id" SERIAL [pk, increment]
"user_id" INTEGER [unique, not null]
"job_id" INTEGER [unique, not null]
"message" TEXT
"cv" BYTEA [not null]
"status" application_status [not null, default: "Applied"]
"applied_at" timestamptz [not null, default: `NOW()`]

Indexes {
user_id [name: "idx_job_applications_user_id"]
job_id [name: "idx_job_applications_job_id"]
}
}

Ref:"companies"."id" < "jobs"."company_id"

Ref:"jobs"."id" < "job_skills"."job_id"

Ref:"users"."id" < "user_skills"."user_id"

Ref:"companies"."id" < "employers"."company_id"

Ref:"users"."id" < "job_applications"."user_id"

Ref:"jobs"."id" < "job_applications"."job_id"