Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion API/routes/receipt_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from services.receipt_service import IReceiptService
from utils.helpers.jwt_utils import JwtUtils

router = APIRouter(prefix="/receipt", tags=["Receipt"])
router = APIRouter(tags=["Receipt"])

def get_current_user_id(request: Request) -> int:
"""
Expand Down
1 change: 1 addition & 0 deletions Mobile/androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ dependencies {
implementation(libs.compose.material3)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.compose.foundation)
implementation(libs.androidx.foundation)
debugImplementation(libs.compose.ui.tooling)

// Core Compose dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.example.budgeting.android.data.model

data class ProcessedItem(
val name: String,
val quantity: Int,
val price: Double,
val category: String,
val keywords: List<String>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.example.budgeting.android.data.model

data class ReceiptProcessResponse(
val items: List<ProcessedItem>,
val total: Double
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.budgeting.android.data.network

import com.example.budgeting.android.data.model.ReceiptProcessResponse
import okhttp3.MultipartBody
import retrofit2.Response
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part

interface ReceiptApiService {
@Multipart
@POST("/receipt/process-receipt")
suspend fun processReceipt(@Part image: MultipartBody.Part): Response<ReceiptProcessResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
import java.util.concurrent.TimeUnit

object RetrofitClient {
private val BASE_URL: String = BuildConfig.BASE_URL
Expand All @@ -18,7 +19,7 @@ object RetrofitClient {
private val moshi = Moshi.Builder()
.add(KotlinJsonAdapterFactory())
.build()

fun getMoshi(): Moshi = moshi

private val moshiConverterFactory = MoshiConverterFactory.create(moshi)
Expand Down Expand Up @@ -107,4 +108,21 @@ object RetrofitClient {

retrofit.create(CategoryApiService::class.java)
}

val receiptInstance: ReceiptApiService = run {
val client = OkHttpClient.Builder()
.addInterceptor(TokenAuthInterceptor())
.connectTimeout(60, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60, TimeUnit.SECONDS)
.build()

val retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.client(client)
.addConverterFactory(moshiConverterFactory)
.build()

retrofit.create(ReceiptApiService::class.java)
}
}
Loading
Loading