def api_contract_delete(*, userid, contractid): 'delete contract' if not userid: raise APIValueError('userid') if not contractid: raise APIValueError('contractid') affected = yield from Contract.mexecute( 'DELETE FROM contracts WHERE userid=? and contractid=?', [userid, contractid]) affected2 = yield from Contract.mexecute( 'DELETE FROM contracts WHERE userid=? and contractid=?', [contractid, userid]) return {'affected': affected, 'affected2': affected2}
def api_contract_update(*, userid, contractid, note): 'add note for contract' if not userid: raise APIValueError('userid') if not contractid: raise APIValueError('contractid') affected = yield from Contract.mexecute( 'UPDATE contracts SET note = ? WHERE userid = ? AND contractid = ?;', [note, userid, contractid]) return {'affected': affected}