Permalink
Browse files

Define Mech and MechDesign model classes, and add them to the schema

  • Loading branch information...
markerikson committed Dec 8, 2016
1 parent 5e2b5d5 commit f28fee9a98c7a5efa456c7e20f1906dca4431ae7
Showing with 35 additions and 2 deletions.
  1. +3 −1 src/app/schema/schema.js
  2. +17 −0 src/features/mechs/Mech.js
  3. +9 −0 src/features/mechs/MechDesign.js
  4. +6 −1 src/features/pilots/Pilot.js
View
@@ -1,8 +1,10 @@
import {Schema} from "redux-orm";
import Pilot from "features/pilots/Pilot";
import MechDesign from "features/mechs/MechDesign";
import Mech from "features/mechs/Mech";
const schema = new Schema();
schema.register(Pilot);
schema.register(Pilot, MechDesign, Mech);
export default schema;
View
@@ -0,0 +1,17 @@
import {Model, fk} from "redux-orm";
export default class Mech extends Model {
static get fields() {
return {
type : fk("MechDesign"),
pilot : fk("Pilot"),
};
}
static parse(mechData) {
return this.create(mechData);
}
}
Mech.modelName = "Mech";
@@ -0,0 +1,9 @@
import {Model} from "redux-orm";
export default class MechDesign extends Model {
static parse(designData) {
return this.create(designData);
}
}
MechDesign.modelName = "MechDesign";
@@ -1,7 +1,12 @@
import {Model} from "redux-orm";
import {Model, fk} from "redux-orm";
export default class Pilot extends Model {
static get fields() {
return {
mech : fk("Mech"),
};
}
static parse(pilotData) {
// We could do useful stuff in here with relations,

0 comments on commit f28fee9

Please sign in to comment.