package com.pixelized.server.lwa.server.rest.tag

import com.pixelized.server.lwa.server.Engine
import com.pixelized.server.lwa.utils.extentions.exception
import com.pixelized.shared.lwa.protocol.rest.APIResponse
import io.ktor.server.response.respond
import io.ktor.server.routing.RoutingContext

fun Engine.getAlterationTags(): suspend RoutingContext.() -> Unit {
    return {
        try {
            call.respond(
                message = APIResponse.success(
                    data = tagService.alterations(),
                ),
            )
        } catch (exception: Exception) {
            call.exception(
                exception = exception,
            )
        }
    }
}