[ 
https://issues.apache.org/jira/browse/S2GRAPH-194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daewon Jeong updated S2GRAPH-194:
---------------------------------
    Description: 
I was looking for a bug while looking at the API to create the `deleteService` 
function in `graphql`.

The code below is a management API that delete the service.
{noformat}
   
def delete(id: Int)(implicit session: DBSession = AutoSession) = {
    val service = findById(id)
    val serviceName = service.serviceName
    sql"""delete from service_columns where id = ${id}""".execute.apply()
    val cacheKeys = List (s "id = $ id", s "serviceName = $ serviceName")

    cacheKeys.foreach {key =>
      expireCache (key)
      expireCaches (key)
    }
  }
{noformat}
After deleting all of the serviceColumns associated with it, but there is no 
part to erase the service.

Improvement direction.
 # Check whether the label associated with the service exists
 # Add a friendly error message (change return type from Boolean to Try)

  was:
I was looking for a bug while looking at the API to create the `deleteService` 
function in `graphql`.

The code below is a management API that delete the service.
{noformat}
   
def delete(id: Int)(implicit session: DBSession = AutoSession) = {
    val service = findById(id)
    val serviceName = service.serviceName
    sql """delete from service_columns where id = ${id}""".execute.apply()
    val cacheKeys = List (s "id = $ id", s "serviceName = $ serviceName")

    cacheKeys.foreach {key =>
      expireCache (key)
      expireCaches (key)
    }
  }
{noformat}
After deleting all of the serviceColumns associated with it, but there is no 
part to erase the service.

Improvement direction.
 # Check whether the label associated with the service exists
 # Add a friendly error message (change return type from Boolean to Try)


>  Provides a way to remove `service`
> -----------------------------------
>
>                 Key: S2GRAPH-194
>                 URL: https://issues.apache.org/jira/browse/S2GRAPH-194
>             Project: S2Graph
>          Issue Type: Bug
>            Reporter: Daewon Jeong
>            Assignee: Daewon Jeong
>            Priority: Minor
>
> I was looking for a bug while looking at the API to create the 
> `deleteService` function in `graphql`.
> The code below is a management API that delete the service.
> {noformat}
>    
> def delete(id: Int)(implicit session: DBSession = AutoSession) = {
>     val service = findById(id)
>     val serviceName = service.serviceName
>     sql"""delete from service_columns where id = ${id}""".execute.apply()
>     val cacheKeys = List (s "id = $ id", s "serviceName = $ serviceName")
>     cacheKeys.foreach {key =>
>       expireCache (key)
>       expireCaches (key)
>     }
>   }
> {noformat}
> After deleting all of the serviceColumns associated with it, but there is no 
> part to erase the service.
> Improvement direction.
>  # Check whether the label associated with the service exists
>  # Add a friendly error message (change return type from Boolean to Try)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to