Skip to content

Konta bankowe #2

Description

@zhenias

Endpoint'y powinny być CRUD'owe, i powinny być obsługiwane jako: GET, POST, PATCH, DELETE.

GET: /api/accounts - wyświetlanie wszystkich kont bankowych.

Endpoint powinien zwracać wszystkie typy kont bankowych.
zwraca w postaci:

{
  "data": [
    {
      "id": "a1b2c3d4-...",
      "name": "Konto osobiste",
      "account_number": "65123456789012345678901234",
      "balance": 123.20,
      "currency": "PLN",
      "type": "current",
      "cards": [ /* uproszczona reprezentacja, bez CVV */ ],
      "created_at": "2026-01-01T12:00:00Z",
      "updated_at": "2026-05-08T08:30:00Z"
    }
  ],
  "links": {
    "first": "...",
    "last": "...",
    "prev": null,
    "next": "..."
  },
  "meta": {
    "current_page": 1,
    "total": 42
  }
}

GET: /api/accounts/{accountId} - wyświetla karty podczepione, oraz reszta danych.

{
  "id": "UUID",
  "name": "Konto oszczędnościowe",
  "account_number": "98123000000000000000000001",
  "balance": 2500.00,
  "currency": "PLN",
  "type": "savings",
  "cards": [
    {
      "id": "UUID-karty",
      "card_number": "4532751234567890",   // można maskować: "4532 **** **** 7890"
      "exp_month": 5,
      "exp_year": 2030,
      "status": "active",
      "type": "debit",
      "created_at": "..."
    }
  ],
  "created_at": "...",
  "updated_at": "..."
}

GET: /api/accounts/{accountId}/cards - wyświetlanie - tylko kart.

{
  {
      "id": "UUID-karty",
      "card_number": "4532751234567890",   // można maskować: "4532 **** **** 7890"
      "exp_month": 5,
      "exp_year": 2030,
      "status": "active",
      "type": "debit",
      "created_at": "..."
    }
}

Activity

  1. zhenias commented on May 9, 2026

    @zhenias
    OwnerAuthor

    Przykładowa migracja, którą proponuję:

    <?php
    
    use Illuminate\Database\Migrations\Migration;
    use Illuminate\Database\Schema\Blueprint;
    use Illuminate\Support\Facades\Schema;
    
    return new class extends Migration
    {
        public function up(): void
        {
            Schema::create('accounts', function (Blueprint $table) {
                $table->uuid('id')->primary();
                $table->foreignUuid('user_id')->constrained()->onDelete('cascade');
                $table->string('name');
                $table->string('account_number', 32)->unique();
                $table->bigInteger('balance')->default(0);
                $table->string('currency', 3)->default('PLN');
                $table->string('type', 20)->default('current');
                $table->timestamps();
    
                $table->index('user_id');
            });
    
            Schema::create('cards', function (Blueprint $table) {
                $table->uuid('id')->primary();
                $table->foreignUuid('account_id')->constrained()->onDelete('cascade');
                $table->string('card_number', 16)->unique();
                $table->unsignedTinyInteger('exp_month');
                $table->unsignedSmallInteger('exp_year');
                $table->string('cvv', 4);
                $table->string('status', 20)->default('active');
                $table->string('type', 20)->default('debit');
                $table->timestamps();
    
                $table->index('account_id');
            });
    
            Schema::create('transactions', function (Blueprint $table) {
                $table->uuid('id')->primary();
                $table->foreignUuid('from_account_id')->nullable()->constrained('accounts')->onDelete('set null');
                $table->foreignUuid('to_account_id')->nullable()->constrained('accounts')->onDelete('set null');
                $table->foreignUuid('from_card_id')->nullable()->constrained('cards')->onDelete('set null');
                $table->bigInteger('amount');
                $table->string('description')->nullable();
                $table->string('type', 30);
                $table->string('status', 20)->default('pending');
                $table->string('reference', 64)->nullable();
                $table->timestamps();
    
                $table->index('from_account_id');
                $table->index('to_account_id');
                $table->index('from_card_id');
                $table->index('reference');
            });
    
            Schema::create('flik_codes', function (Blueprint $table) {
                $table->uuid('id')->primary();
                $table->foreignUuid('card_id')->constrained()->onDelete('cascade');
                $table->string('code', 6);
                $table->timestamp('expires_at');
                $table->string('status', 20)->default('active');
                $table->foreignUuid('used_in_transaction_id')->nullable()->constrained('transactions')->onDelete('set null');
                $table->timestamps();
    
                $table->index('code');
                $table->index('card_id');
            });
        }
    
        public function down(): void
        {
            Schema::dropIfExists('flik_codes');
            Schema::dropIfExists('transactions');
            Schema::dropIfExists('cards');
            Schema::dropIfExists('accounts');
        }
    };
  2. linked a pull request that will close this issue2 konta bankowe #4on May 9, 2026
  3. moved this from Backlog to In progress in Bank app - project plan.on May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions