feat(promotion code): Promotion code system done

I added the features for users to use promotion code
and for promoters to create on their events.
May be rewrite to discount code?
This commit is contained in:
kbe
2025-09-29 15:25:52 +02:00
parent 72d54e02ab
commit 87ccebf229
19 changed files with 391 additions and 302 deletions

10
db/schema.rb generated
View File

@@ -44,13 +44,13 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_28_181311) do
end
create_table "orders", charset: "utf8mb4", collation: "utf8mb4_uca1400_ai_ci", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "event_id", null: false
t.string "status", default: "draft", null: false
t.integer "total_amount_cents", default: 0, null: false
t.integer "payment_attempts", default: 0, null: false
t.timestamp "expires_at"
t.timestamp "last_payment_attempt_at"
t.bigint "user_id", null: false
t.bigint "event_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["event_id", "status"], name: "idx_orders_event_status"
@@ -67,9 +67,13 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_28_181311) do
t.boolean "active", default: true, null: false
t.integer "usage_limit"
t.integer "uses_count", default: 0, null: false
t.bigint "user_id", null: false
t.bigint "event_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["code"], name: "index_promotion_codes_on_code", unique: true
t.index ["event_id"], name: "index_promotion_codes_on_event_id"
t.index ["user_id"], name: "index_promotion_codes_on_user_id"
end
create_table "ticket_types", charset: "utf8mb4", collation: "utf8mb4_uca1400_ai_ci", force: :cascade do |t|
@@ -128,4 +132,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_28_181311) do
add_foreign_key "order_promotion_codes", "orders"
add_foreign_key "order_promotion_codes", "promotion_codes"
add_foreign_key "promotion_codes", "events"
add_foreign_key "promotion_codes", "users"
end