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

Reverse and recursive Relantionships #16

Open
MP0w opened this issue Apr 5, 2016 · 0 comments
Open

Reverse and recursive Relantionships #16

MP0w opened this issue Apr 5, 2016 · 0 comments

Comments

@MP0w
Copy link
Member

MP0w commented Apr 5, 2016

Won't have to be implemented now
We may need it to avoid boilerplate and duplicated structs.
For the serialization might be easy:

struct User {
    let friends: [User]
}

During serialization we have to make sure that friends for User's inside friends is not serialized.
For creation might get more tricky because we can't provide the relationships at initialization time.

Current downsides:
To support /user/:id
You need to create two entities

struct Friend {
    let userId
    let friendId
}
struct User {
    let userId
    let friends: [Friend]
}

Gets even worst with user and friendships you need 4 entities to support /user/:id and /friendship/:id

// for /user/:id
struct Friendship {
    let userId
    let friendshipId
}
struct User {
    let userId
    let friendships: [Friendship]
}
// for /friendship/:id
struct Friendship2 {
    let user: User
    let friendshipId
}
struct User2 {
    let userId
    let friendshipId
}
@MP0w MP0w added this to the Beta-1 milestone Apr 14, 2016
@MP0w MP0w added feature and removed enhancement labels Apr 17, 2016
@MP0w MP0w removed this from the Beta-1 milestone Apr 24, 2016
@MP0w MP0w added this to the Beta-1 milestone May 1, 2016
@MP0w MP0w removed this from the Beta-1 milestone Jun 25, 2016
@MP0w MP0w added this to the 1.0.0 milestone Aug 20, 2016
@MP0w MP0w removed this from the 1.0.0 milestone Sep 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant