Skip to content

Issue #125: Custom data functionality proposition.#128

Open
Azzoo wants to merge 3 commits intoflyvictor:masterfrom
Azzoo:Azzoo-patch-125
Open

Issue #125: Custom data functionality proposition.#128
Azzoo wants to merge 3 commits intoflyvictor:masterfrom
Azzoo:Azzoo-patch-125

Conversation

@Azzoo
Copy link

@Azzoo Azzoo commented Mar 10, 2015

I created .customType method for using customTypes.

See example:
var fortune = require('./fortune')
, app = fortune({
db: 'petstore'
})
.customType('price', {
amount: Number,
units: String
})
.resource('person', {
name: String,
age: Number,
pets: ['pet'] // "has many" relationship to pets
})
.resource('pet', {
name: String,
age: Number,
owner: 'person', // "belongs to" relationship to a person
cost: 'price'
})
.listen(1339);

I created .customType method for using customTypes.

See example:
var fortune = require('./fortune')
    , app = fortune({
        db: 'petstore'
    })
        .customType('price', {
            amount: Number,
            units: String
        })
        .resource('person', {
            name: String,
            age: Number,
            pets: ['pet'] // "has many" relationship to pets
        })
        .resource('pet', {
            name: String,
            age: Number,
            owner: 'person', // "belongs to" relationship to a person
            cost: 'price'
        })
        .listen(1339);
@Azzoo Azzoo changed the title Issue #125 fixing proposition Issue #125: Custom data functionality proposition. Mar 10, 2015
Azzoo added 2 commits March 10, 2015 17:41
There are some changes in .resources function, to fix showing of nested schema's.
And CustomTypes already agregates recursively too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant