SvkRepositoryImpl

class SvkRepositoryImpl @Inject constructor(svkApi: SvkApiService, roomContainer: RoomContainer, ctx: Context) : SvkRepository

Implementation of SvkRepository responsible for handling data operations related to the application.

Constructors

Link copied to clipboard
@Inject
constructor(svkApi: SvkApiService, roomContainer: RoomContainer, ctx: Context)

Functions

Link copied to clipboard
open suspend override fun authenticate(token: String): UserDto

Authenticates a user using the provided authentication token.

Link copied to clipboard
open suspend override fun deleteActiveTransport()

Deletes the active transport from the local database.

Link copied to clipboard
open suspend override fun deleteImage(imageUuid: UUID)

Deletes the image with the specified imageUuid from the local database.

Link copied to clipboard
open suspend override fun finishTransport()

Marks the active transport as finished in the local database.

Link copied to clipboard
open suspend override fun finishTransportByRouteNumber(routeNumber: String)

Finishes a transport with the specified routeNumber in the local database.

Link copied to clipboard
open suspend override fun getActiveTransport(): Transport

Retrieves the active Transport from the local database.

Link copied to clipboard
open suspend override fun getHealth(): HealthDto

Retrieves the health information from the server.

Link copied to clipboard
open suspend override fun getLocalUserByEmail(email: String): UserRoomEntity

Retrieves a local user from the database using the specified email.

Link copied to clipboard
open suspend override fun insertCargo(cargo: Cargo)

Inserts a Cargo into the local database.

Link copied to clipboard
open suspend override fun insertImage(imageUuid: UUID, userId: Int, routeNumber: String, localUri: Uri)

Inserts an image with the specified imageUuid, userId, routeNumber, and localUri into the local database.

Link copied to clipboard
open suspend override fun insertLocalUser(user: UserDto)

Inserts a locally authenticated user into the local database.

Link copied to clipboard
open suspend override fun insertTransport(transport: Transport)

Inserts a Transport into the local database.

Link copied to clipboard
open suspend override fun login(loginDto: LoginDto): UserDto

Attempts to log in a user using the provided loginDto.

Link copied to clipboard
open suspend override fun patchTransport(transport: Transport): TransportDto

Updates an existing transport on the server.

Link copied to clipboard
open suspend override fun postImage(image: File): String

Uploads an image to the server.

Link copied to clipboard
open suspend override fun postTransport(transport: Transport): TransportDto

Posts a transport to the server.

Link copied to clipboard
open suspend override fun register(body: LoginDto): UserDto

Registers a new user with the provided body information.

Link copied to clipboard
open suspend override fun syncTransports()

Initiates the synchronization of transports using a background worker.

Link copied to clipboard
open suspend override fun updateCargo(oldCargoNumber: String, newCargoNumber: String)

Updates the cargo number in the local database from oldCargoNumber to newCargoNumber.

Link copied to clipboard
open suspend override fun updateLocalTransport(transport: Transport)

Updates the local database entry for the given Transport.