dreibart / dreibart.github.io

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

Request Notes #6

Closed LokiMidgard closed 1 month ago

LokiMidgard commented 1 month ago

Definition der Schnittstellen:

'/character/{id:number}/notes': {
    'GET': {
        result: [{
            type: 'object',
            properties: {
                type: {
                    type: 'enum',
                    values: ['notes']
                },
                notes: {
                    type: 'array',
                    valueType: {
                        type: 'object',
                        properties: {
                            id: { type: 'number' },
                            text: { type: 'string' },
                            created: { type: 'date-time' },
                            image: {
                                type: 'number',
                                optional: true,
                            }
                        }
                    }
                }
            }
        }]
    },
    'PATCH': {
        body: {
            type: 'object',
            properties: {
                text: { type: 'string' },
                image: {
                    type: 'bytes',
                    optional: true,
                }
            }
        },
        result: [{
            type: 'object',
            properties: {
                type: { type: 'enum', values: ['note'] },
                id: { type: 'number' },
                text: { type: 'string' },
                created: { type: 'date-time' },
                image: {
                    type: 'number',
                    optional: true,
                }
            }
        }]
    }
},
'/character/{id:number}/notes/{note_id:number}': {
    'DELETE': {
        result: [{
            type: 'enum',
            values: ['succsess']
        }]
    },
    "PATCH": {
        body: {
            type: 'object',
            properties: {
                text: {
                    type: 'one-off',
                    select: [
                        { type: 'string' },
                        { type: 'null' },
                    ],
                    optional: true,
                },
                image: {
                    type: 'one-off',
                    select: [
                        { type: 'bytes' },
                        { type: 'null' },
                    ],
                    optional: true,
                }
            }
        },
        result: [{
            type: 'object',
            properties: {
                type: { type: 'enum', values: ['note'] },
                id: { type: 'number' },
                text: { type: 'string' },
                created: { type: 'date-time' },
                image: {
                    type: 'number',
                    optional: true,
                }
            }
        }]
    }
},
goebelt commented 1 month ago

ich würde noch die Felder "title" oder "topic" und "changed" ergänzen

LokiMidgard commented 1 month ago

erledigt

Bilder sollten auch korrekt übermittelt werden.

goebelt commented 1 month ago

Bei den Bildern habe ich aber noch Probleme beim ablegen. Das werde ich mir später ansehen. Ändern und Anlegen von Notizen klappt aber schon gut. Ich mache noch den Titel änderbar und dann sollte das erst mal passen.

goebelt commented 1 month ago

Bilder funktionieren jetzt auch, aber da müssen wir noch mal schauen, dass wir die API gleichziehen. Ich verstehe auch nicht, wie ich es schaffe kein Bild mit zusenden (nachdem mal eins ausgewählt wurde).

LokiMidgard commented 1 month ago

geht auch noch nicht ;) löschen klappt noch nicht.

Aber er sollte es nocht nochmal senden, wenn es nicht geändert wurde

LokiMidgard commented 1 month ago

Ich übermittele null als wert wenn es gelöcht wird. undefined wenn es nicht geändert wird

goebelt commented 1 month ago

Ich übermittele null als wert wenn es gelöcht wird. undefined wenn es nicht geändert wird

Ich kann die beiden Zustände leider nicht unterscheiden. Da müssen wir uns etwas anderes ausdenken.

LokiMidgard commented 1 month ago

https://stackoverflow.com/a/16470016/3485361 eventuell hift das

goebelt commented 1 month ago

erfolgreich getestet und damit abgeschlossen