@@ -2,7 +2,7 @@ var express = require('express');
2
2
var db = require ( '../db' ) ;
3
3
4
4
function fetchTodos ( req , res , next ) {
5
- db . all ( 'SELECT rowid AS id, * FROM todos WHERE owner_id = ?' , [
5
+ db . all ( 'SELECT * FROM todos WHERE owner_id = ?' , [
6
6
req . user . id
7
7
] , function ( err , rows ) {
8
8
if ( err ) { return next ( err ) ; }
@@ -67,15 +67,15 @@ router.post('/:id(\\d+)', function(req, res, next) {
67
67
next ( ) ;
68
68
} , function ( req , res , next ) {
69
69
if ( req . body . title !== '' ) { return next ( ) ; }
70
- db . run ( 'DELETE FROM todos WHERE rowid = ? AND owner_id = ?' , [
70
+ db . run ( 'DELETE FROM todos WHERE id = ? AND owner_id = ?' , [
71
71
req . params . id ,
72
72
req . user . id
73
73
] , function ( err ) {
74
74
if ( err ) { return next ( err ) ; }
75
75
return res . redirect ( '/' + ( req . body . filter || '' ) ) ;
76
76
} ) ;
77
77
} , function ( req , res , next ) {
78
- db . run ( 'UPDATE todos SET title = ?, completed = ? WHERE rowid = ? AND owner_id = ?' , [
78
+ db . run ( 'UPDATE todos SET title = ?, completed = ? WHERE id = ? AND owner_id = ?' , [
79
79
req . body . title ,
80
80
req . body . completed !== undefined ? 1 : null ,
81
81
req . params . id ,
@@ -87,7 +87,7 @@ router.post('/:id(\\d+)', function(req, res, next) {
87
87
} ) ;
88
88
89
89
router . post ( '/:id(\\d+)/delete' , function ( req , res , next ) {
90
- db . run ( 'DELETE FROM todos WHERE rowid = ? AND owner_id = ?' , [
90
+ db . run ( 'DELETE FROM todos WHERE id = ? AND owner_id = ?' , [
91
91
req . params . id ,
92
92
req . user . id
93
93
] , function ( err ) {
0 commit comments