Skip to content

Commit

Permalink
Api: Add support for note.source property
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed May 11, 2024
1 parent a90e3e0 commit a747828
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/lib/services/rest/Api.test.ts
Expand Up @@ -180,6 +180,7 @@ describe('services/rest/Api', () => {
latitude: '48.732071',
longitude: '-3.458700',
altitude: '21',
source: 'testing',
}));

const noteId = response.id;
Expand All @@ -189,19 +190,22 @@ describe('services/rest/Api', () => {
expect(note.latitude).toBe('48.73207100');
expect(note.longitude).toBe('-3.45870000');
expect(note.altitude).toBe('21.0000');
expect(note.source).toBe('testing');
}

await api.route(RequestMethod.PUT, `notes/${noteId}`, null, JSON.stringify({
latitude: '49',
longitude: '-3',
altitude: '22',
source: 'testing 2',
}));

{
const note = await Note.load(noteId);
expect(note.latitude).toBe('49.00000000');
expect(note.longitude).toBe('-3.00000000');
expect(note.altitude).toBe('22.0000');
expect(note.source).toBe('testing 2');
}
}));

Expand Down
1 change: 1 addition & 0 deletions packages/lib/services/rest/routes/notes.ts
Expand Up @@ -166,6 +166,7 @@ async function requestNoteToNote(requestNote: RequestNote): Promise<NoteEntity>
if ('longitude' in requestNote) output.longitude = requestNote.longitude;
if ('latitude' in requestNote) output.latitude = requestNote.latitude;
if ('altitude' in requestNote) output.altitude = requestNote.altitude;
if ('source' in requestNote) output.source = requestNote.source;

if (!output.markup_language) output.markup_language = MarkupToHtml.MARKUP_LANGUAGE_MARKDOWN;

Expand Down

0 comments on commit a747828

Please sign in to comment.