@@ -9,31 +9,31 @@ module.exports = {
99 destroy
1010}
1111
12- async function account ( root , args , session ) {
12+ async function account ( root , args , session ) {
1313 if ( ! session . account )
1414 throw Error ( 'not authorized' )
1515 let copy = session . account
1616 delete copy . token
1717 return copy
1818}
1919
20- async function draft ( root , args , session ) {
21- return await data . get ( {
22- table : 'drafts' ,
20+ async function draft ( root , args ) {
21+ return data . get ( {
22+ table : 'drafts' ,
2323 ...args
2424 } )
2525}
2626
27- async function drafts ( root , args , session ) {
28- return await data . get ( {
29- table : 'drafts' ,
27+ async function drafts ( ) {
28+ return data . get ( {
29+ table : 'drafts' ,
3030 } )
3131}
3232
33- async function save ( root , draft , session ) {
33+ async function save ( root , draft , session ) {
3434 if ( ! session . account )
3535 throw Error ( 'not authorized' )
36- let required = [ 'title' , 'body' ] //, 'author', 'avatar']
36+ let required = [ 'title' , 'body' ] // , 'author', 'avatar']
3737 for ( let param of required ) {
3838 if ( ! draft [ param ] )
3939 throw ReferenceError ( `missing param ${ param } ` )
@@ -44,17 +44,17 @@ async function save(root, draft, session) {
4444 draft . avatar = session . account . avatar
4545 draft . title = xss ( draft . title )
4646 draft . body = xss ( draft . body )
47- return await data . set ( {
48- table : 'drafts' ,
47+ return data . set ( {
48+ table : 'drafts' ,
4949 ...draft
5050 } )
5151}
5252
53- async function destroy ( root , draft , session ) {
53+ async function destroy ( root , draft , session ) {
5454 if ( ! session . account )
5555 throw Error ( 'not authorized' )
56- return await data . destroy ( {
57- table : 'drafts' ,
56+ return data . destroy ( {
57+ table : 'drafts' ,
5858 ...draft
5959 } )
6060}
0 commit comments