# Vouchers Module ## Story * As an admin, I want to create offers that are: * Only available to specific users * automatically activated / expired for the attached users according to individual starts_at and ends_at time stamps ## Tables ### Voucher * t.bigint id * t.bigint offer_id * t.string user_id * t.string phone_number * t.datetime starts_at * t.datetime ends_at * t.timestamps An admin can create a voucher, with either a user_id or a phone_number. Multiple vouchers can exist for the same user. Each voucher has it's own starts_at and ends_at timestamps. ### Offer We add the following rule: Entity: User Method: has_voucher Relation: is Value: True User.has_voucher checks for a voucher that is available. Each voucher can only be used once. The offer coupon_code itself can be used as the voucher code.