Begin Transaction

mail@pastecode.io avatar
unknown
javascript
2 years ago
580 B
6
Indexable
Never
export default async function specialSubjectAllocationCreate(req: Request, res: Response): Promise<any> {
  try {
    const auth = getAuth(req);
    const body = req.body;

    
    await req.namespace.db.query('BEGIN');

    /**
     * QUERY INSERT / UPDATE
     * 
     */


    await req.namespace.db.query('COMMIT');
    
    success(res, {
      status: true,
      version: req.version,
      message: 'success',
      data: result,
      meta: null,
    });
  } catch (e) {
    await req.namespace.db.query('ROLLBACK');
    failure(res, e);
  }
}