This commit is contained in:
		@@ -23,7 +23,6 @@ fun Application.module() {
 | 
			
		||||
    install(ContentNegotiation) {
 | 
			
		||||
        gson {
 | 
			
		||||
            setPrettyPrinting()
 | 
			
		||||
            setDateFormat("yyyy-MM-dd HH:mm:ss")
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,7 @@
 | 
			
		||||
package com.kmalbz.api.model
 | 
			
		||||
 | 
			
		||||
import com.google.gson.annotations.SerializedName
 | 
			
		||||
import java.time.LocalDate
 | 
			
		||||
 | 
			
		||||
data class SampleObject(
 | 
			
		||||
    @SerializedName("date") val date: LocalDate,
 | 
			
		||||
    @SerializedName("device_id") val device_id: String
 | 
			
		||||
)
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
package com.kmalbz.api.route
 | 
			
		||||
 | 
			
		||||
import com.google.gson.Gson
 | 
			
		||||
import com.google.gson.GsonBuilder
 | 
			
		||||
import com.kmalbz.api.model.ApiObject
 | 
			
		||||
import com.kmalbz.api.model.SampleObject
 | 
			
		||||
@@ -33,6 +32,7 @@ import org.koin.ktor.ext.inject
 | 
			
		||||
import java.io.File
 | 
			
		||||
import java.io.InputStream
 | 
			
		||||
import java.io.OutputStream
 | 
			
		||||
import java.time.LocalDate
 | 
			
		||||
import java.util.*
 | 
			
		||||
import javax.activation.MimetypesFileTypeMap
 | 
			
		||||
 | 
			
		||||
@@ -65,7 +65,7 @@ class InputServiceServer {
 | 
			
		||||
        val queueName = channel.queueDeclare().queue
 | 
			
		||||
        channel.queueBind(queueName, rabbitExchangeName, "")
 | 
			
		||||
 | 
			
		||||
        val gson = GsonBuilder().setDateFormat("yyyy-MM-dd").setPrettyPrinting().create()
 | 
			
		||||
        val gson = GsonBuilder().setPrettyPrinting().create()
 | 
			
		||||
 | 
			
		||||
        get("/sample"){
 | 
			
		||||
            call.respond(resultObjectService.getAllInputObjects())
 | 
			
		||||
@@ -100,7 +100,7 @@ class InputServiceServer {
 | 
			
		||||
 | 
			
		||||
            val tag = UUID.randomUUID().toString()
 | 
			
		||||
 | 
			
		||||
            val currentApiObject = ApiObject(tag = tag, date = description!!.date, device_id = description!!.device_id)
 | 
			
		||||
            val currentApiObject = ApiObject(tag = tag, date = LocalDate.now(), device_id = description!!.device_id)
 | 
			
		||||
 | 
			
		||||
            transaction {
 | 
			
		||||
                resultObjectService.addOne(currentApiObject)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								test.py
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								test.py
									
									
									
									
									
								
							@@ -2,7 +2,6 @@
 | 
			
		||||
import requests
 | 
			
		||||
import os.path
 | 
			
		||||
import json
 | 
			
		||||
import datetime
 | 
			
		||||
 | 
			
		||||
URL = "http://127.0.0.1:8080/sample"
 | 
			
		||||
 | 
			
		||||
@@ -10,7 +9,7 @@ FILE = 'CommonStarling_102761_45.wav'
 | 
			
		||||
 | 
			
		||||
files = {
 | 
			
		||||
	"file": (os.path.basename(FILE), open(FILE,'rb').read(), 'audio/wave', {'Content-length' : os.path.getsize(FILE)}),
 | 
			
		||||
	"description" : (None, json.dumps({"date" : datetime.date.today().strftime("%Y-%m-%d"), "device_id" : "123"}), "application/json")
 | 
			
		||||
	"description" : (None, json.dumps({"device_id" : "123"}), "application/json")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
r = requests.post(URL,files=files)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user