-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add frontend and backend directories and boilerplate
- Loading branch information
Showing
159 changed files
with
30,615 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
frontend/types/*.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"projects": { | ||
"default": "cubepb-65c9e" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
firebase-debug.log* | ||
firebase-debug.*.log* | ||
|
||
# Firebase cache | ||
.firebase/ | ||
|
||
# Firebase config | ||
|
||
# Uncomment this if you'd like others to create their own Firebase project. | ||
# For a team working on the same Firebase project(s), it is recommended to leave | ||
# it commented so all members can deploy to the same project(s) in .firebaserc. | ||
# .firebaserc | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# dotenv environment variables file | ||
.deploy_info | ||
env.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"mysql": { | ||
"password": "PASSWORD", | ||
"host": "HOST", | ||
"user": "USER", | ||
"database": "DATABASE", | ||
"port": "PORT" | ||
"socketpath": "SOCKETPATH" | ||
}, | ||
"pusher": { | ||
"key": "PUSHER_KEY", | ||
"cluster": "CLUSTER", | ||
"app_id": "APP_ID", | ||
"secret": "SECRET" | ||
}, | ||
"wca": { | ||
"base_url": "https://staging.worldcubeassociation.org/", | ||
"client_secret": "example-secret", | ||
"client_id": "example-application-id", | ||
"redirect_uri": "http://localhost:3000/wca-redirect" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"functions": { | ||
"predeploy": [ | ||
"npm --prefix \"$RESOURCE_DIR\" run lint", | ||
"npm --prefix \"$RESOURCE_DIR\" run build" | ||
] | ||
}, | ||
"emulators": { | ||
"functions": { | ||
"port": 5001 | ||
}, | ||
"ui": { | ||
"enabled": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
parser: "@typescript-eslint/parser", | ||
extends: [ | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier/@typescript-eslint", | ||
"plugin:prettier/recommended", | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: "module", | ||
}, | ||
rules: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Compiled JavaScript files | ||
lib/**/*.js | ||
lib/**/*.js.map | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Node.js dependency directory | ||
node_modules/ |
73 changes: 73 additions & 0 deletions
73
backend/functions/db/migrations/20210224123833_migration_name.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import * as Knex from "knex"; | ||
|
||
export async function up(knex: Knex): Promise<void[]> { | ||
return Promise.all([ | ||
knex.schema.createTable("user", function (table) { | ||
table.increments(); | ||
table.string("provider").notNullable(); | ||
table.string("provider_id").notNullable(); | ||
table.string("wca_id").nullable(); | ||
table.string("email").notNullable().unique(); | ||
table.string("name").notNullable(); | ||
table.string("avatar").nullable(); | ||
table.string("country").nullable(); | ||
table.boolean("is_public").notNullable().defaultTo(true); | ||
table.integer("role").notNullable().defaultTo(1); | ||
table.json("permissions").nullable(); | ||
table.dateTime("created_at").notNullable().defaultTo(knex.fn.now()); | ||
table.dateTime("updated_at").nullable(); | ||
table.integer("created_by").notNullable(); | ||
table.unique(["provider", "provider_id"]); | ||
}), | ||
knex.schema.createTable("event", function (table) { | ||
table.increments(); | ||
table.string("name").notNullable(); | ||
table.string("code").notNullable().unique(); | ||
table.dateTime("created_at").notNullable().defaultTo(knex.fn.now()); | ||
table.dateTime("updated_at").nullable(); | ||
table.integer("created_by").notNullable(); | ||
}), | ||
knex.schema.createTable("product", function (table) { | ||
table.increments(); | ||
table.string("name").notNullable(); | ||
table.dateTime("created_at").notNullable().defaultTo(knex.fn.now()); | ||
table.dateTime("updated_at").nullable(); | ||
table.integer("created_by").notNullable(); | ||
}), | ||
knex.schema.createTable("personalBestClass", function (table) { | ||
table.increments(); | ||
table.string("name").notNullable(); | ||
table.text("description").nullable(); | ||
table.dateTime("created_at").notNullable().defaultTo(knex.fn.now()); | ||
table.dateTime("updated_at").nullable(); | ||
table.integer("created_by").notNullable(); | ||
}), | ||
knex.schema.createTable("personalBest", function (table) { | ||
table.increments(); | ||
table.integer("pb_class").notNullable(); | ||
table.integer("event").notNullable(); | ||
table.integer("set_size").notNullable(); | ||
table.integer("score").notNullable(); | ||
table.integer("attempts_succeeded").notNullable().defaultTo(1); | ||
table.integer("attempts_total").notNullable().defaultTo(1); | ||
table.integer("product").nullable(); | ||
table.date("happened_on").notNullable(); | ||
table.integer("time_elapsed").notNullable(); | ||
table.boolean("show_ms").notNullable().defaultTo(false); | ||
table.dateTime("created_at").notNullable().defaultTo(knex.fn.now()); | ||
table.dateTime("updated_at").nullable(); | ||
table.integer("created_by").notNullable(); | ||
table.unique(["pb_class", "event", "set_size"]); | ||
}), | ||
]); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void[]> { | ||
return Promise.all([ | ||
knex.schema.dropTable("user"), | ||
knex.schema.dropTable("event"), | ||
knex.schema.dropTable("product"), | ||
knex.schema.dropTable("personalBestClass"), | ||
knex.schema.dropTable("personalBest"), | ||
]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as Knex from "knex"; | ||
|
||
export async function seed(knex: Knex): Promise<void> { | ||
// Deletes ALL existing entries | ||
await knex("user").del(); | ||
|
||
// Inserts seed entries | ||
await knex("user").insert([ | ||
{ | ||
provider: "wca", | ||
provider_id: "277", | ||
wca_id: "2008VIRO01", | ||
email: "[email protected]", | ||
name: "Philippe Virouleau", | ||
avatar: | ||
"https://staging.worldcubeassociation.org/uploads/user/avatar/2008VIRO01/1473886131.jpg", | ||
country: "FR", | ||
is_public: true, | ||
role: "3", | ||
permissions: null, | ||
created_by: 0, | ||
}, | ||
]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
export const env = require("../env.json"); | ||
|
||
export const production = { | ||
client: "pg", | ||
connection: { | ||
host: env.pg.host, | ||
user: env.pg.user, | ||
password: env.pg.password, | ||
database: env.pg.database, | ||
...(env.pg.port && { port: env.pg.port }), | ||
}, | ||
pool: { min: 0, max: 1 }, | ||
migrations: { | ||
tableName: "knex_migrations", | ||
directory: "./db/migrations", | ||
}, | ||
seeds: { | ||
directory: "./db/seeds", | ||
}, | ||
}; | ||
|
||
export const development = { | ||
client: "pg", | ||
connection: { | ||
host: env.pg_dev.host, | ||
user: env.pg_dev.user, | ||
password: env.pg_dev.password, | ||
database: env.pg_dev.database, | ||
...(env.pg_dev.port && { port: env.pg_dev.port }), | ||
}, | ||
pool: { min: 0, max: 1 }, | ||
migrations: { | ||
tableName: "knex_migrations", | ||
directory: "./db/migrations", | ||
}, | ||
seeds: { | ||
directory: "./db/seeds", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import * as Knex from "knex"; | ||
|
||
export async function up(knex: Knex): Promise<void[]> { | ||
return Promise.all([ | ||
knex.schema.createTable("user", function (table) { | ||
table.increments(); | ||
table.string("provider").notNullable(); | ||
table.string("provider_id").notNullable(); | ||
table.string("wca_id").nullable(); | ||
table.string("email").notNullable().unique(); | ||
table.string("name").notNullable(); | ||
table.string("avatar").nullable(); | ||
table.string("country").nullable(); | ||
table.boolean("is_public").notNullable().defaultTo(true); | ||
table.integer("role").notNullable().defaultTo(1); | ||
table.json("permissions").nullable(); | ||
table.dateTime("created_at").notNullable().defaultTo(knex.fn.now()); | ||
table.dateTime("updated_at").nullable(); | ||
table.integer("created_by").notNullable(); | ||
table.unique(["provider", "provider_id"]); | ||
}), | ||
knex.schema.createTable("event", function (table) { | ||
table.increments(); | ||
table.string("name").notNullable(); | ||
table.string("code").notNullable().unique(); | ||
table.dateTime("created_at").notNullable().defaultTo(knex.fn.now()); | ||
table.dateTime("updated_at").nullable(); | ||
table.integer("created_by").notNullable(); | ||
}), | ||
knex.schema.createTable("product", function (table) { | ||
table.increments(); | ||
table.string("name").notNullable(); | ||
table.dateTime("created_at").notNullable().defaultTo(knex.fn.now()); | ||
table.dateTime("updated_at").nullable(); | ||
table.integer("created_by").notNullable(); | ||
}), | ||
knex.schema.createTable("personalBestClass", function (table) { | ||
table.increments(); | ||
table.string("name").notNullable(); | ||
table.text("description").nullable(); | ||
table.dateTime("created_at").notNullable().defaultTo(knex.fn.now()); | ||
table.dateTime("updated_at").nullable(); | ||
table.integer("created_by").notNullable(); | ||
}), | ||
knex.schema.createTable("personalBest", function (table) { | ||
table.increments(); | ||
table.integer("pb_class").notNullable(); | ||
table.integer("event").notNullable(); | ||
table.integer("set_size").notNullable(); | ||
table.integer("score").notNullable(); | ||
table.integer("attempts_succeeded").notNullable().defaultTo(1); | ||
table.integer("attempts_total").notNullable().defaultTo(1); | ||
table.integer("product").nullable(); | ||
table.date("happened_on").notNullable(); | ||
table.integer("time_elapsed").notNullable(); | ||
table.boolean("show_ms").notNullable().defaultTo(false); | ||
table.dateTime("created_at").notNullable().defaultTo(knex.fn.now()); | ||
table.dateTime("updated_at").nullable(); | ||
table.integer("created_by").notNullable(); | ||
table.unique(["pb_class", "event", "set_size"]); | ||
}), | ||
]); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void[]> { | ||
return Promise.all([ | ||
knex.schema.dropTable("user"), | ||
knex.schema.dropTable("event"), | ||
knex.schema.dropTable("product"), | ||
knex.schema.dropTable("personalBestClass"), | ||
knex.schema.dropTable("personalBest"), | ||
]); | ||
} |
Oops, something went wrong.