Skip to content

Commit

Permalink
Create our new service
Browse files Browse the repository at this point in the history
  • Loading branch information
WillSams committed Feb 14, 2023
1 parent 1165d30 commit babeaaf
Show file tree
Hide file tree
Showing 14 changed files with 603 additions and 2 deletions.
Empty file added .dockerignore
Empty file.
11 changes: 11 additions & 0 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export ENV=development

export API_PORT=4000

export DB_CLIENT=postgresql

export DB_USER=postgres
export DB_PASSWD=postgres
export DB_HOST=localhost
export DB_PORT=15432
export DB_URL=postgres://${DB_USER}:${DB_PASSWD}@${DB_HOST}:${DB_PORT}/${DB_DEV}
2 changes: 1 addition & 1 deletion .github/workflows/branch-name-check.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Enforce Branch Name Semantics
on:
pull_request:
branches: ["master"]
branches: ["main"]
workflow_dispatch:
jobs:
lint-branch-name:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
name: Deploy Package
on:
push:
branches: [ master ]
branches: [ main ]
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
# ...even if they are in subdirectories
!*/

!db/**/*
!docs/**/*
!.envrc.example
!.github/**/*
!handlers/**/*
!specs/**/*
!Dockerfile
!docker-compose.yml
!.dockerignore
**/node_modules
Empty file added Dockerfile
Empty file.
36 changes: 36 additions & 0 deletions db/knexfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const defaults = {
client: process.env.DB_CLIENT,
migrations: {
directory: './migrations',
tableName: 'knex_migrations'
},
pool: { min: 2, max: 10 },
debug: false,
};

const connection = {
host: process.env.DB_HOST,
port: process.env.DB_PORT,
user: process.env.DB_USER,
password: process.env.DB_PASSWD,
};

module.exports = {
development: {
...defaults,
connection: {
...connection,
database: 'hotel_development',
},
seeds: { directory: './seeds/development', },
},

test: {
...defaults,
connection: {
...connection,
database: 'hotel_test',
},
seeds: { directory: './seeds/test', },
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
exports.up = async knex => {
return knex.schema
.createTable('rooms', table => {
table.string('id').primary().unique();
table.integer('num_beds');
table.boolean('allow_smoking');
table.integer('daily_rate');
table.integer('cleaning_fee');
})
.createTable('reservations', table => {
table.increments('id').primary();
table.string('room_id').references('rooms.id');
table.string('checkin_date');
table.string('checkout_date');
table.integer('total_charge');
table.unique(['room_id', 'checkin_date', 'checkout_date']);
});
};

exports.down = async knex =>
knex.schema.dropTable('reservations').dropTable('rooms');
Loading

0 comments on commit babeaaf

Please sign in to comment.