editDomainTerm :: P.ProductID -> Int64 -> APIDomainTerm -> App APIDomainTerm
editDomainTerm pID dtID (APIDomainTerm _ _ t d) = do
  dbConfig          <- reader getDBConfig
  domainTerm        <- liftIO $ runReaderT (runPool (DT.findDomainTerm (toKey dtID))) (getPool dbConfig)
  case domainTerm of
    Nothing   -> lift $ throwError $ err404
    (Just dt) ->
      (liftIO $ runReaderT (runPool (DT.updateDomainTerm (toKey dtID) dt)) (getPool dbConfig))
        >> (return $ APIDomainTerm { domainTermID = Just (dtID)
                                   , productID    = Just (toKey pID)
                                   , title        = t
                                   , description  = d
                                   })
editDomainTerm :: P.ProductID -> Int64 -> APIDomainTerm -> App APIDomainTerm
editDomainTerm pID dtID (APIDomainTerm _ _ t d) = do
  dbConfig          <- reader getDBConfig
  domainTerm        <- liftIO $ runReaderT (runPool (DT.findDomainTerm (toKey dtID))) (getPool dbConfig)
  case domainTerm of
    Nothing   -> lift $ throwError $ err404
    (Just dt) ->
      (liftIO $ runReaderT (runPool (DT.updateDomainTerm (toKey dtID) dt)) (getPool dbConfig))
        >> (return $ APIDomainTerm { domainTermID = Just (dtID)
                                   , productID    = Just (toKey pID)
                                   , title        = t
                                   , description  = d
                                   })
editDomainTerm pID dtID (APIDomainTerm _ _ t d) = do
  dbConfig          <- reader getDBConfig
  domainTerm        <- liftIO $ runReaderT (runPool (DT.findDomainTerm (toKey dtID))) (getPool dbConfig)
  case domainTerm of
    Nothing   -> lift $ throwError $ err404
    (Just dt) ->
      (liftIO $ runReaderT (runPool (DT.updateDomainTerm (toKey dtID) dt)) (getPool dbConfig))
        >> (return $ APIDomainTerm { domainTermID = Just (dtID)
                                   , productID    = Just (toKey pID)
                                   , title        = t
                                   , description  = d
                                   })