Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seed Script for bid_requests table 🌱 #52

Closed
6 tasks
DiegoB1911 opened this issue Dec 12, 2024 · 12 comments · Fixed by #60
Closed
6 tasks

Seed Script for bid_requests table 🌱 #52

DiegoB1911 opened this issue Dec 12, 2024 · 12 comments · Fixed by #60

Comments

@DiegoB1911
Copy link
Contributor

Objective

Create a comprehensive seed script for the bid_requests table with realistic test data that simulates various scenarios.

Requirements

  • Generate seed data that covers all possible bid statuses
  • Include diverse price ranges and move-in dates
  • Ensure proper relationships with apartments and users

Implementation Checklist

  • Write SQL seed script
  • Verify foreign key constraints with apartments and users tables
  • Ensure data diversity across all statuses
  • Test seed script for consistency
  • Include proper timestamp generation for all date fields
  • Validate price constraints

Considerations

  1. Use uuid_generate_v4() for ID generation
  2. Reference existing apartment and user IDs
  3. Generate realistic price ranges based on apartment types
  4. Create timestamps that make sense (created_at < updated_at)

SQL Table

CREATE TABLE bid_requests (
    id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    apartment_id UUID REFERENCES apartments(id) ON DELETE CASCADE,
    tenant_id TEXT REFERENCES users(id) ON DELETE CASCADE,
    current_status TEXT NOT NULL DEFAULT 'PENDING',
    proposed_price DECIMAL(10,2) NOT NULL CHECK (proposed_price > 0),
    desired_move_in TIMESTAMP WITH TIME ZONE NOT NULL,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
    updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
    deleted_at TIMESTAMP WITH TIME ZONE,
    CONSTRAINT valid_status CHECK (
        current_status IN (
            'PENDING',
            'VIEWED',
            'APPROVED',
            'CONFIRMED',
            'ESCROW_FUNDED',
            'ESCROW_COMPLETED',
            'CANCELLED'
        )
    )
);

Acceptance Criteria

A complete SQL seed script for bid_requests table

@DiegoB1911 DiegoB1911 changed the title Create Seed Script for Bid Requests Table 🌱 Create Seed Script for bid_requests table 🌱 Dec 12, 2024
@DiegoB1911 DiegoB1911 changed the title Create Seed Script for bid_requests table 🌱 Seed Script for bid_requests table 🌱 Dec 12, 2024
@ShantelPeters
Copy link

ShantelPeters commented Dec 12, 2024

Is it okay if I take this?

I am a full stack blockchain developer and I have a strong background in Cairo,python, JavaScript, typescript . HTML , solidity etc..
This would be my first time contributing to this ecosystem

@Amarjeet325
Copy link

May I handle this issue?

@mimisavage
Copy link

May I pick this up?

@Jagadeeshftw
Copy link

Hi,
I’d love to work on this issue as I have strong experience in building and managing APIs, handling server-side operations, and ensuring robust back-end performance.
Please assign this to me, and I’ll deliver a secure and high-quality PR within 12-24 hours.

@Nityam573
Copy link

Let me handle this issue!

@1nonlypiece
Copy link

May I try my hand at this?

@Josue19-08
Copy link
Contributor

Hi, I'm Josué, a full-stack developer, and I'm part of the Dojo Coding community. I have experience in programming languages such as Angular, React, TypeScript, C#, .NET, C++, PHP, Python, Java, Node.js, and JavaScript, among others. I'm also knowledgeable in databases, including SQL, SQLite, Azure, Mongo, and Elasticsearch. I'm passionate about software development and enjoy contributing to open-source projects, applying my knowledge to solve problems in a practical way.

I will create a seed script for the bid_requests table with realistic test data that covers all possible bid statuses, diverse price ranges, and move-in dates. I will ensure proper relationships with the apartments and users tables by referencing existing IDs. I will generate realistic price ranges based on apartment types and ensure that timestamps make sense (created_at < updated_at). Additionally, I will verify foreign key constraints and test the seed script for consistency, ensuring the data covers all statuses and adheres to price constraints.

@od-hunter
Copy link

Hi, please can I be assigned this please? This would be my first time contributing to this project and I would love to be the given the opportunity to contribute. I have experience in html, css, JavaScript,TypeScript and solidity, and Cairo.

To solve this issue, I’ll take the following steps:
1.⁠ ⁠First of all I’ll have to understand bid_requests table schema, which includes, foreign key relationships (apartment_id- apartments, tenant_id-users), constraints proposed_price > 0, created_at < updated_at, and valid current_status.
2.⁠ ⁠⁠Then I’ll write an SQL script using INSERT INTO to populate the bid_requests table, I’ll fetch apartment_id and tenant_id from related tables with SELECT ... ORDER BY RANDOM() LIMIT 1, then generate realistic data using functions-
RANDOM() for price ranges, NOW() + INTERVAL for timestamps and also make sure to ensure coverage of all current_status values with multiple INSERT rows.
3.⁠ ⁠I’ll use uuid_generate_v4() for unique IDs, I’ll validate timestamps (created_at vs. updated_at) and make sure to also respect constraints.
4.⁠ ⁠⁠Lastly, I’ll test for constraints like CHECK on current_status and proposed_price, I’ll verify foreign key relationships for apartments and users and run the script in a development environment to confirm data integrity.

Kindly assign me please, I’m up for the task.

@Supa-mega
Copy link

Can I jump on this task?

@suhas-sensei
Copy link

I’m interested in this one. I'll create a comprehensive seed script for the bid_requests table covering all statuses (PENDING through ESCROW_COMPLETED) with realistic prices and dates.
I'll ensure proper relationships with apartments/users tables while maintaining logical timestamp sequences and valid price ranges.

@IsaacHerreraAguilar
Copy link
Contributor

Hi, I'm Isaac Herrera. I'm a FrontEnd developer with 2 years of experience. I have experience with JS, TS & SQL, and I could help with this issue. I'm very interested.
My proposal would be: 1. Run the command hasura seed create bid_request to create the seed. 2. Create an sql code to insert data into the table. 3. Run the command hasura seed apply to verify the functionality.

@Kom02
Copy link

Kom02 commented Dec 12, 2024

Hi, I’m Kevin Obando Molina, a full-stack software developer with 2 years of experience. I have worked with languages such as Java, JavaScript, TypeScript, MySQL, C#, and Python. I’m very interested in working on and learning more about this topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.