dreibart / dreibart.github.io

https://dreibart.github.io/
0 stars 0 forks source link

GET Request der Daten zu einem Character liefert #2

Open LokiMidgard opened 4 months ago

LokiMidgard commented 4 months ago

Rout /character/{id}

Eine möglichkeit wäre alle daten des Characters zu Liefern, oder nur die wichtigsten, und einige properties in sub querys auszulagern.

z.B. /character/{id}/skills.

Beides hat vor und nachteile.

Für ein gesamtes könnte die rückgabe wie folgt aussehn:

'/character/{id:number}/neu': {
    'GET': {
        result: [{
            type: 'object',
            properties: {
                "type":{ type: 'enum', values:['character'] },
                "id": { type: 'number' },
                "name": { type: 'string' },
                "world": {
                    type: 'object',
                    properties: {
                        "id": { type: 'number' },
                        "name": { type: 'string' },
                    }
                },
                "category": { "type": 'string' },  // Type feld des Characters
                "age": { "type": 'number' },
                "gender": {
                    "type": 'enum',
                    values: ['male', 'female', 'other']
                },
                "size": { type: "number" },
                "weight": { type: "number" },
                "alignment": { type: "string" },
                "race": {
                    type: 'object',
                    properties: {
                        "id": { type: 'number' },
                        "name": { type: 'string' },
                    }
                },
                "impediment": { type: 'number' },
                "magic-resistance": {
                    type: 'object',
                    properties: {
                        "current": { type: 'number' },
                        "maximum": { type: 'number' },
                    }
                },
                "passive-defense": {
                    type: 'object',
                    properties: {
                        "current": { type: 'number' },
                        "maximum": { type: 'number' },
                    }
                },
                "pools": {
                    type: 'object',
                    properties: {
                        "fatique": { type: 'number' },
                        "conzentration": { type: 'number' },
                        "mana": { type: 'number' },
                        "contact": { type: 'number' },
                    }
                },
                "points": {
                    type: 'object',
                    "properties": {
                        attrbute: {
                            type: 'object',
                            properties: {
                                used: { type: 'number' },
                                available: { type: 'number' },
                            }
                        },
                        skill: {
                            type: 'object',
                            properties: {
                                used: { type: 'number' },
                                available: { type: 'number' },
                            }
                        }
                    }
                }
            }
        }]
    }

},
Beispiel ```json { "id": 840, "name": "Max Musterman", "world": { "name":"Cornea", "id":4, }, "typ": "Verwaltungsfachangestellter", "age": 25, "gender":"male", "size": 180, "weight": 70, "alignment": "Bürokrat", "race": "Mensch", "impediment": 10, "magic-resistance": { "current": 3, "max": 10, }, "passive-defense": { "current": 3, "max": 10, }, "pools": { "fatique": 30, "conzentration": 20, "mana": 12, "contact": 13, }, "points": { "attribute": { "used": 120, "available": 30, }, "skill": { "used": 120, "available": 30, }, }, } ```
LokiMidgard commented 4 months ago

Wir machen mehrere abfrage

Originalpost geändert

LokiMidgard commented 4 months ago

Ist der Name der Welt Unique? Andernfalls, würde ich noch die zusätzlich die ID der welt kennen müssen.

goebelt commented 2 months ago

Ist der Name der Welt Unique? Andernfalls, würde ich noch die zusätzlich die ID der welt kennen müssen.

Welt ID ist bereitgestellt. Der Name der Welt ist nicht unique, aber da die ID gegeben ist, passt das so