Skip to content

Conversation

@CryptoSCK
Copy link

@CryptoSCK CryptoSCK commented Jun 28, 2025

Implement Room Database Entity for Todo Items

Description

Task

Create Room database entity for Todo items

Acceptance Criteria

  • Room entity created for Todo items
  • All properties mapped to database columns
  • Validation implemented for title and description
  • Support for optional fields
  • Auto-generated primary key
  • Timestamps tracked automatically

Summary of Work

This pull request implements the Room database entity for Todo items, establishing a robust and validated database schema for storing todo items in the application.

Changes Made

  • Created a Room database entity (Todo.kt) with the following key features:
    • Defined a data class annotated with @Entity for Room database mapping
    • Implemented primary key with auto-generation
    • Added column mappings for all Todo item properties
    • Included validation logic in the init block

Implementation Details

  • Entity Properties:
    1. id: Auto-generated primary key
    2. title: Required, non-blank title with max length of 100 characters
    3. description: Optional description with max length of 500 characters
    4. isCompleted: Boolean flag to track todo item completion status
    5. createdAt: Timestamp of todo item creation (defaults to current time)
    6. dueDate: Optional due date for the todo item

Validation Implemented

  • Ensures title is not blank
  • Limits title to 100 characters
  • Limits description to 500 characters (if provided)
  • Uses Kotlin's require function for robust input validation

Database Schema

  • Table Name: "todos"
  • Columns mapped with appropriate Room annotations
  • Supports nullable fields for flexible todo item creation

Notes

  • Uses LocalDateTime for date and timestamp fields
  • Follows Room database best practices
  • Provides flexibility for future extensions

Changes Made

  • Created Todo.kt with Room entity annotations
  • Implemented property validation in init block
  • Added column mappings for all properties
  • Supported nullable and optional fields
  • Used LocalDateTime for timestamps

Tests

  • Verify entity creation with all valid properties
  • Test validation for blank title
  • Test title length validation
  • Test description length validation
  • Verify auto-generation of id
  • Verify default values for optional fields

Signatures

Staking Key

941izj4WsQqBwNLsSgDf3BSKS1dJMbS1q9d2o23ZjBHp: VYBWNP1Xg2yxPnmXdKuZ4TQSPCSm5VmwHUgWnNacgKCEARfwSuZb41kqmiToDcC2nzPAFTLBz1U25k1LyZvDhu6vXyDnmyiRLApDzVSXuR39rQtj5KpbmyyFDHA4Z1EuftQZDr4fH2E8XzHDBZxvvsUewNcEZWTw15vtDtDTJS98wKwsxTbVLzy93eG151xgJp8x4mMZdPULe1CvxNXMvcvfBPjdo6LXtBURj9svx3qLFMxca4XhzeaiCbAzyFx6ShHkGqRM6b5uJHB76qN8unNdSmAH6G8so5Xd92WRaDNjZnLGSxwESiPfzmZHiqcBXc3mNGmVLB3qa86MELnYo8nFCVcD7ekGHuk56aEeLjiPCVFzTG9hpYqTT52nj5XncxsP6M6or6czLKSgkBRCaj9e11gcDnbcCtk

Public Key

EWghpH7Xb9HL74TitMBog5Vow8nFjpdJfNCa6hc2wfca: 3cd34Y7BJ5toemV3E7uEsG9RtdbuWrVtWiYbaskuWJhY8B5ST7DH1ndW4xoVLfTsskQDFYB5NMt1aMs7YPCAJoydvzYRn5sb8TpZTEkct7sz977nYeCCJbuBw64sMMiFFbzSuBN3vh4AssfS1YvzAx9TEHY5E4uQ2Y1iZRjkmUPqJggUNdvPFi1LCMhouBP3E6h9barEdVUaxR4jwkSNhrYaJb7pQp2NJEPgXpnST1zLrtfzM6JrRR7yHgrbkqBYGUKNFxzdK1MzNzPczgmx24QW2iLu8XRD3GLCZPRQYHt664xv7pKQkftEaDT9oNP94sYcQj69pKfRnpRfvJpHdYBbYkpC8FMmqhAxyJ4MHhVTRWQcnpJbZ841wSZbbBFvpeXEFfQVNKGpv88YAYgBkFjxyDrrZTuHRARA

@CryptoSCK CryptoSCK changed the title [WIP] Implement Room Database Entity for Todo Items Implement Room Database Entity for Todo Items Jun 28, 2025
@CryptoSCK CryptoSCK marked this pull request as ready for review June 28, 2025 17:33
region999 added a commit to region999/kotlinTodoApp that referenced this pull request Jul 5, 2025
sopheakim added a commit to sopheakim/kotlinTodoApp that referenced this pull request Jul 5, 2025
valin1993 added a commit to valin1993/kotlinTodoApp that referenced this pull request Jul 5, 2025
gapcomputer added a commit to gapcomputer/kotlinTodoApp that referenced this pull request Jul 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant