-
Notifications
You must be signed in to change notification settings - Fork 2
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
52 changed files
with
2,255 additions
and
14 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,11 @@ | ||
# Project Changelog | ||
|
||
> *[Return to Directory](README.md)* | ||
## v0.1.1 | ||
|
||
- Fixed the outstanding errors with SQLite3 migrations. Because SQLite3 does not supposrt adding foreign keys after a table is created, foreign key creation is now conditionally added based on the environment. | ||
- Another issue with migrations was fixed by moving all table definitions back to a subfolder, because Knex's migrations API doesn't seem to allow you to exclude files. | ||
- Added some documentation, including a project Roadmap and a Changelog. | ||
- Added missing dependency Winston-Loggly-Bulk. | ||
- Removed leftover references to previous express server implementation in routes. |
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,6 @@ | ||
# Scribe Documentation | ||
|
||
##<a name="contents"></a> Table of Contents | ||
|
||
- [Project Roadmap](ROADMAP.md) | ||
- [Changelog](CHANGELOG.md) |
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,37 @@ | ||
# Project Roadmap | ||
|
||
> *[Return to Directory](README.md)* | ||
## v0.2.0 | ||
|
||
- [ ] Refactor Types/Models to condense data schema into one place per table. | ||
- [ ] Write basic project documentation (setup, getting started, etc) ie: [README](../README.md) | ||
- [ ] Wire-up Hapi Routes | ||
- [X] Troubleshoot remaining issues with SQLite Migrations / Knex schema | ||
- [ ] Add pagination query arguments for lists | ||
|
||
## v0.3.0 | ||
|
||
- [ ] Add remaining mutations to enable populating the database via the API | ||
- [ ] Add private tables / type definitions | ||
- [ ] Tables: Account, Collection, Binders, Decks, OwnedCards, misc | ||
- [ ] Type definitions/queries/mutations for above | ||
|
||
## v0.4.0 | ||
|
||
- [ ] Setup login/signup REST API | ||
- [ ] Add authentication layer to GraphQL API for private Tables | ||
- [ ] Add rate-limiting to public GraphQL API | ||
|
||
## v0.5.0 | ||
|
||
- [ ] Add application state history table / frontend utility APIs | ||
- [ ] Add trading API / services | ||
- [ ] Create service to grab pricing data from public API sources | ||
- [ ] Add GraphQL types/queries to expose pricing data | ||
- [ ] Add tables / type definitions for Trading platform | ||
|
||
## v0.6.0 | ||
|
||
- [ ] Refactor GraphQL resolvers to use batch SQL querying (speculative) | ||
- [ ] ...? |
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,53 @@ | ||
import db from '../../config/bookshelf.config' | ||
|
||
import Card from './card' | ||
import AbilityTypes from './abilityTypes' | ||
import AbilityTypeCards from './abilityTypeCards' | ||
|
||
export default class abilityType extends db.Model { | ||
get tableName() { | ||
return 'abilitytype' | ||
} | ||
|
||
static fields(table) { | ||
// Fields | ||
table.bigIncrements(`id`) | ||
.notNullable() | ||
.primary() | ||
|
||
table.string(`name`) | ||
.comment(`The name of the ability type.`) | ||
.notNullable() | ||
|
||
table.text(`description`) | ||
.comment(`Description of the ability type.`) | ||
|
||
table.bigInteger(`cards`) | ||
.comment(`The cards associated with this abilityType.`) | ||
.notNullable() | ||
.unsigned() | ||
.index(`abilityType_cards`) | ||
|
||
// Timestamps | ||
table.timestamps() | ||
} | ||
|
||
static foreignKeys(table) { | ||
table.foreign(`cards`) | ||
.references(`abilitytype`) | ||
.inTable(`abilitytypecards`) | ||
.onDelete(`CASCADE`) | ||
.onUpdate(`NO ACTION`) | ||
} | ||
|
||
abilityTypes() { | ||
return this.belongsTo(AbilityTypes) | ||
} | ||
|
||
cards() { | ||
return this.hasMany(Card, `card`) | ||
.through(AbilityTypeCards) | ||
} | ||
} | ||
|
||
export const AbilityType = new abilityType() |
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,49 @@ | ||
import db from '../../config/bookshelf.config' | ||
|
||
import Card from './card' | ||
import AbilityType from './abilityType' | ||
|
||
export default class abilityTypeCards extends db.Model { | ||
get tableName() { | ||
return 'abilitytypecards' | ||
} | ||
|
||
static fields(table) { | ||
// Fields | ||
table.bigInteger(`abilitytype`) | ||
.comment(`The abilityType associated with this card.`) | ||
.notNullable() | ||
.unsigned() | ||
.index(`abilityTypeCards_abilitytype`) | ||
|
||
table.bigInteger(`card`) | ||
.comment(`The card associated with this abilityType.`) | ||
.notNullable() | ||
.unsigned() | ||
.index(`abilityTypeCards_card`) | ||
|
||
// Timestamps | ||
table.timestamps() | ||
|
||
// Keys | ||
table.primary([`abilitytype`, `card`]) | ||
} | ||
|
||
static foreignKeys(table) { | ||
table.foreign(`card`) | ||
.references(`id`) | ||
.inTable(`card`) | ||
.onDelete(`NO ACTION`) | ||
.onUpdate(`NO ACTION`) | ||
} | ||
|
||
abilityType() { | ||
return this.belongsTo(AbilityType) | ||
} | ||
|
||
card() { | ||
return this.hasMany(Card) | ||
} | ||
} | ||
|
||
export const AbilityTypeCards = new abilityTypeCards() |
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,49 @@ | ||
import db from '../../config/bookshelf.config' | ||
|
||
import Card from './card' | ||
import AbilityType from './abilityType' | ||
|
||
export default class abilityTypes extends db.Model { | ||
get tableName() { | ||
return 'abilitytypes' | ||
} | ||
|
||
static fields(table) { | ||
// Fields | ||
table.bigInteger(`card`) | ||
.comment(`The card associated with this abilityType.`) | ||
.notNullable() | ||
.unsigned() | ||
.index(`abilitytypes_card`) | ||
|
||
table.bigInteger(`abilitytype`) | ||
.comment(`The abilityType associated with this card.`) | ||
.notNullable() | ||
.unsigned() | ||
.index(`abilitytypes_abilitytype`) | ||
|
||
// Timestamps | ||
table.timestamps() | ||
|
||
// Keys | ||
table.primary([`card`, `abilitytype`]) | ||
} | ||
|
||
static foreignKeys(table) { | ||
table.foreign(`abilitytype`) | ||
.references(`id`) | ||
.inTable(`abilitytype`) | ||
.onDelete(`NO ACTION`) | ||
.onUpdate(`NO ACTION`) | ||
} | ||
|
||
abilityType() { | ||
return this.belongsTo(AbilityType) | ||
} | ||
|
||
card() { | ||
return this.hasMany(Card) | ||
} | ||
} | ||
|
||
export const AbilityTypes = new abilityTypes() |
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,52 @@ | ||
import db from '../../config/bookshelf.config' | ||
|
||
import Card from './card' | ||
import ArtistCards from './artistCards' | ||
|
||
export default class artist extends db.Model { | ||
get tableName() { | ||
return `artist` | ||
} | ||
|
||
static fields(table) { | ||
// Fields | ||
table.bigIncrements(`id`) | ||
.notNullable() | ||
.primary() | ||
|
||
table.string(`name`) | ||
.comment(`The name of the artist.`) | ||
.notNullable() | ||
|
||
table.text(`website`) | ||
.comment(`The website of the artist, if they have one.`) | ||
|
||
table.bigInteger(`cards`) | ||
.comment(`The cards associated with this artist.`) | ||
.notNullable() | ||
.unsigned() | ||
.index(`artist_cards`) | ||
|
||
// Timestamps | ||
table.timestamps() | ||
} | ||
|
||
static foreignKeys(table) { | ||
table.foreign(`cards`) | ||
.references(`artist`) | ||
.inTable(`artistcards`) | ||
.onDelete(`CASCADE`) | ||
.onUpdate(`NO ACTION`) | ||
} | ||
|
||
card() { | ||
return this.belongsTo(Card, 'artist') | ||
} | ||
|
||
cards() { | ||
return this.hasMany(Card, `card`) | ||
.through(ArtistCards) | ||
} | ||
} | ||
|
||
export const Artist = new artist() |
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,49 @@ | ||
import db from '../../config/bookshelf.config' | ||
|
||
import Card from './card' | ||
import Artist from './artist' | ||
|
||
export default class artistCards extends db.Model { | ||
get tableName() { | ||
return `artistcards` | ||
} | ||
|
||
static fields(table) { | ||
// Fields | ||
table.bigInteger(`artist`) | ||
.comment(`The artist associated with this card.`) | ||
.notNullable() | ||
.unsigned() | ||
.index(`artistCards_artist`) | ||
|
||
table.bigInteger(`card`) | ||
.comment(`The card associated with this artist.`) | ||
.notNullable() | ||
.unsigned() | ||
.index(`artistCards_card`) | ||
|
||
// Timestamps | ||
table.timestamps() | ||
|
||
// Keys | ||
table.primary([`artist`, `card`]) | ||
} | ||
|
||
static foreignKeys(table) { | ||
table.foreign(`card`) | ||
.references(`id`) | ||
.inTable(`card`) | ||
.onDelete(`NO ACTION`) | ||
.onUpdate(`NO ACTION`) | ||
} | ||
|
||
artist() { | ||
return this.belongsTo(Artist) | ||
} | ||
|
||
card() { | ||
return this.hasMany(Card) | ||
} | ||
} | ||
|
||
export const ArtistCards = new artistCards() |
Oops, something went wrong.