mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
API: Support is_todo property to allow making a note a todo (#1688)
This commit is contained in:
parent
917dcea28a
commit
a796a9d179
@ -189,6 +189,39 @@ describe('services_rest_Api', function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should create todos', async (done) => {
|
||||||
|
let response = null;
|
||||||
|
const f = await Folder.save({ title: "stuff to do" });
|
||||||
|
|
||||||
|
response = await api.route('POST', 'notes', null, JSON.stringify({
|
||||||
|
title: 'testing',
|
||||||
|
parent_id: f.id,
|
||||||
|
is_todo: 1
|
||||||
|
}));
|
||||||
|
expect(response.is_todo).toBe(1);
|
||||||
|
|
||||||
|
response = await api.route('POST', 'notes', null, JSON.stringify({
|
||||||
|
title: 'testing 2',
|
||||||
|
parent_id: f.id,
|
||||||
|
is_todo: 0
|
||||||
|
}));
|
||||||
|
expect(response.is_todo).toBe(0);
|
||||||
|
|
||||||
|
response = await api.route('POST', 'notes', null, JSON.stringify({
|
||||||
|
title: 'testing 3',
|
||||||
|
parent_id: f.id,
|
||||||
|
}));
|
||||||
|
expect(response.is_todo).toBeUndefined();
|
||||||
|
|
||||||
|
response = await api.route('POST', 'notes', null, JSON.stringify({
|
||||||
|
title: 'testing 4',
|
||||||
|
parent_id: f.id,
|
||||||
|
is_todo: '1'
|
||||||
|
}));
|
||||||
|
expect(response.is_todo).toBe(1);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
it('should create folders with supplied ID', async (done) => {
|
it('should create folders with supplied ID', async (done) => {
|
||||||
const response = await api.route('POST', 'folders', null, JSON.stringify({
|
const response = await api.route('POST', 'folders', null, JSON.stringify({
|
||||||
id: '12345678123456781234567812345678',
|
id: '12345678123456781234567812345678',
|
||||||
|
@ -456,6 +456,7 @@ class Api {
|
|||||||
if ('author' in requestNote) output.author = requestNote.author;
|
if ('author' in requestNote) output.author = requestNote.author;
|
||||||
if ('user_updated_time' in requestNote) output.user_updated_time = Database.formatValue(Database.TYPE_INT, requestNote.user_updated_time);
|
if ('user_updated_time' in requestNote) output.user_updated_time = Database.formatValue(Database.TYPE_INT, requestNote.user_updated_time);
|
||||||
if ('user_created_time' in requestNote) output.user_created_time = Database.formatValue(Database.TYPE_INT, requestNote.user_created_time);
|
if ('user_created_time' in requestNote) output.user_created_time = Database.formatValue(Database.TYPE_INT, requestNote.user_created_time);
|
||||||
|
if ('is_todo' in requestNote) output.is_todo = Database.formatValue(Database.TYPE_INT, requestNote.is_todo);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user