-
-
Notifications
You must be signed in to change notification settings - Fork 755
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
790 additions
and
632 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
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 |
---|---|---|
@@ -1,17 +1,20 @@ | ||
|
||
# For more information about the properties used in | ||
# this file, please see the EditorConfig documentation: | ||
# http://editorconfig.org/ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
|
||
# Change these settings to your own preference | ||
indent_style = space | ||
insert_final_newline = true | ||
indent_size = 2 | ||
|
||
# We recommend you to keep these unchanged | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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
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
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 @@ | ||
/** | ||
* React Starter Kit for Firebase | ||
* https://github.com/kriasoft/react-firebase-starter | ||
* Copyright (c) 2015-present Kriasoft | MIT License | ||
*/ | ||
|
||
require('dotenv').config(); | ||
|
||
// Knex configuration | ||
// http://knexjs.org/#knexfile | ||
module.exports = { | ||
client: 'pg', | ||
}; |
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,54 @@ | ||
/** | ||
* React Starter Kit for Firebase | ||
* https://github.com/kriasoft/react-firebase-starter | ||
* Copyright (c) 2015-present Kriasoft | MIT License | ||
*/ | ||
|
||
/* prettier-ignore */ | ||
|
||
exports.up = async db => { | ||
await db.schema.createTable('users', table => { | ||
table.uuid('id').notNullable().defaultTo(db.raw('uuid_generate_v4()')).primary(); | ||
table.string('display_name', 100); | ||
table.string('photo_url', 200); | ||
table.timestamps(false, true); | ||
}); | ||
|
||
await db.schema.createTable('stories', table => { | ||
table.uuid('id').notNullable().defaultTo(db.raw('uuid_generate_v4()')).primary(); | ||
table.uuid('author_id').notNullable().references('id').inTable('users').onDelete('CASCADE').onUpdate('CASCADE'); | ||
table.string('title', 80).notNullable(); | ||
table.string('url', 200); | ||
table.text('text'); | ||
table.timestamps(false, true); | ||
}); | ||
|
||
await db.schema.createTable('story_points', table => { | ||
table.uuid('story_id').references('id').inTable('stories').onDelete('CASCADE').onUpdate('CASCADE'); | ||
table.uuid('user_id').notNullable().references('id').inTable('users').onDelete('CASCADE').onUpdate('CASCADE'); | ||
table.primary(['story_id', 'user_id']); | ||
}); | ||
|
||
await db.schema.createTable('comments', table => { | ||
table.uuid('id').notNullable().defaultTo(db.raw('uuid_generate_v4()')).primary(); | ||
table.uuid('story_id').notNullable().references('id').inTable('stories').onDelete('CASCADE').onUpdate('CASCADE'); | ||
table.uuid('parent_id').references('id').inTable('comments').onDelete('CASCADE').onUpdate('CASCADE'); | ||
table.uuid('author_id').notNullable().references('id').inTable('users').onDelete('CASCADE').onUpdate('CASCADE'); | ||
table.text('text'); | ||
table.timestamps(false, true); | ||
}); | ||
|
||
await db.schema.createTable('comment_points', table => { | ||
table.uuid('comment_id').references('id').inTable('comments').onDelete('CASCADE').onUpdate('CASCADE'); | ||
table.uuid('user_id').notNullable().references('id').inTable('users').onDelete('CASCADE').onUpdate('CASCADE'); | ||
table.primary(['comment_id', 'user_id']); | ||
}); | ||
}; | ||
|
||
exports.down = async db => { | ||
await db.schema.dropTableIfExists('comment_points'); | ||
await db.schema.dropTableIfExists('comments'); | ||
await db.schema.dropTableIfExists('story_points'); | ||
await db.schema.dropTableIfExists('stories'); | ||
await db.schema.dropTableIfExists('users'); | ||
}; |
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
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,25 @@ | ||
/** | ||
* React Starter Kit for Firebase | ||
* https://github.com/kriasoft/react-firebase-starter | ||
* Copyright (c) 2015-present Kriasoft | MIT License | ||
*/ | ||
|
||
'use script'; | ||
|
||
process.env.NODE_ENV = 'test'; | ||
|
||
require('@babel/register')({ | ||
babelrc: false, | ||
presets: [require.resolve('babel-preset-react-app')], | ||
}); | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const graphql = require('graphql'); | ||
const schema = require('../src/graphql/schema').default; | ||
|
||
fs.writeFileSync( | ||
path.resolve(__dirname, '../src/schema.graphql'), | ||
graphql.printSchema(schema, { commentDescriptions: true }), | ||
'utf8', | ||
); |
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
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
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.