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

Content: add contents to Game #12

Open
Virako opened this issue Dec 26, 2018 · 2 comments
Open

Content: add contents to Game #12

Virako opened this issue Dec 26, 2018 · 2 comments
Assignees
Milestone

Comments

@Virako
Copy link
Member

Virako commented Dec 26, 2018

Create API REST for Content:

  • Create serializers and use deserializers for create/update
  • Create factories for tests with factory-boy
  • For create content, there are two ways:
content-way1: {   // Thing or Character already exist in DB
    game: game_pk, // int,
    position: (lat, lng),  // tuple(float, float),
    content_type: "Item/Knowledge/Rol/Player/NPC", // str
    content_id: item_id, rol_id, ..., // id
}
content-way2: {  // Thing or Character not exist and you should create
    game: game_pk, // int,
    position: (lat, lng),  // tuple(float, float),
    content_type: "Item/Knowledge/Rol/Player/NPC", // str
    content: {
        // Thing or Character serializered
    },  
    content_id: item_id, rol_id, ... (when content will be created), // id
}
  • Create contents inside games:

When we are creating a game, we should be able to create contents inside game. There are two ways for create:

game-way1: {  // Thing or Character already exist
            'title': 'Example',
            'start': '2018-02-04T07:28:12.546030+00:00',
            'preferences': {
                'vision_distance': 100,
                'meeting_distance': 20,
                'visible_character': True
            }
            'contents': [
                {
                    game: not neccesary you should use this game,
                    position: (lat, lng),  // tuple(float, float),
                    content_type: "Item/Knowledge/Rol/Player/NPC", // str
                    content_id: item_id, rol_id, ..., // id
                },
            ],
}

game-way2: {  // Thing or Character not exist and you should create
            'title': 'Example',
            'start': '2018-02-04T07:28:12.546030+00:00',
            'preferences': {
                'vision_distance': 100,
                'meeting_distance': 20,
                'visible_character': True
            }
            'contents': [
                {
                    game: not neccesary you should use this game,
                    position: (lat, lng),  // tuple(float, float),
                    content_type: "Item/Knowledge/Rol/Player/NPC", // str
                    content: {
                        // Thing or Character serializered
                    },  
                    content_id: item_id, rol_id, ..., // id
                },
            ],
}
@Virako Virako added this to the v1 milestone Dec 26, 2018
@Virako Virako self-assigned this Dec 26, 2018
@Virako
Copy link
Member Author

Virako commented Dec 27, 2018

Done: Content API

I had done some changes:

  • content_type is pk instead str
  • position is a dict: {"latitude": float, "longitude": float} instead tuple (float, float)

Pending: Game with contents

@Virako
Copy link
Member Author

Virako commented Dec 27, 2018

PR: done #18

Virako added a commit that referenced this issue Dec 29, 2018
* Added for contents: serializers/deserializers for create/update, factories, api rest and tests
* Improved game views and test for added contents to Game
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

No branches or pull requests

1 participant