Manuel Bustillo
2147d7ad5e
All checks were successful
Run unit tests / rubocop (push) Successful in 27s
Run unit tests / check-licenses (push) Successful in 32s
Run unit tests / copyright_notice (push) Successful in 36s
Run unit tests / unit_tests (push) Successful in 1m22s
Run unit tests / build-static-assets (push) Successful in 10m9s
## Why The current way of creating and deleting simulations doesn't scale for big instances. We cannot generate 50 simulations every time a guest confirms attendance, and we should not delete existing valuable simulations. For example, if a guest confirms attendance and declines right after, previously generated simulations should still be valid. ## What In this PR we are introducing a series of changes that make simulations management easier: 1. We're removing the automatic creation of simulations. 2. Simulations are not removed anymore, neither manually nor automatically. 3. A new endpoint has been defined to create simulations on demand. 4. A digest property has been defined to determine whether a simulation is still valid (meaning there have not been any change in the list of guests involved). Reviewed-on: #222 Co-authored-by: Manuel Bustillo <bustikiller@bustikiller.com> Co-committed-by: Manuel Bustillo <bustikiller@bustikiller.com>
25 lines
577 B
Ruby
25 lines
577 B
Ruby
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
|
|
|
# frozen_string_literal: true
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: weddings
|
|
#
|
|
# id :uuid not null, primary key
|
|
# slug :string not null
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_weddings_on_slug (slug) UNIQUE
|
|
#
|
|
class Wedding < ApplicationRecord
|
|
SLUG_REGEX = /[a-z\d-]+/
|
|
|
|
validates :slug, presence: true, uniqueness: true, format: { with: /\A#{SLUG_REGEX}\z/ }
|
|
|
|
has_many :guests, dependent: :delete_all
|
|
end
|