Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #125: Custom data functionality proposition. #128

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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