From d110c64e7ade3dfccebdceabd48efff3b345013d Mon Sep 17 00:00:00 2001 From: Chris Jean-Marie Date: Mon, 4 Nov 2024 22:11:41 +0000 Subject: [PATCH] Initial secret-gift-exchange --- ...241103140734_secret-gift-exchange.down.sql | 5 +++ ...20241103140734_secret-gift-exchange.up.sql | 27 ++++++++++++ backend/src/secret_gift_exchange.rs | 42 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 backend/migrations/20241103140734_secret-gift-exchange.down.sql create mode 100644 backend/migrations/20241103140734_secret-gift-exchange.up.sql create mode 100644 backend/src/secret_gift_exchange.rs diff --git a/backend/migrations/20241103140734_secret-gift-exchange.down.sql b/backend/migrations/20241103140734_secret-gift-exchange.down.sql new file mode 100644 index 0000000..506c33d --- /dev/null +++ b/backend/migrations/20241103140734_secret-gift-exchange.down.sql @@ -0,0 +1,5 @@ +-- Add down migration script here +drop table gift_exchange; +drop table gift_exchange_participants; + +delete from role_permissions where item = '/giftexchange'; diff --git a/backend/migrations/20241103140734_secret-gift-exchange.up.sql b/backend/migrations/20241103140734_secret-gift-exchange.up.sql new file mode 100644 index 0000000..ce169d2 --- /dev/null +++ b/backend/migrations/20241103140734_secret-gift-exchange.up.sql @@ -0,0 +1,27 @@ +-- Add up migration script here +CREATE TABLE + `gift_exchange` ( + `id` integer not null primary key autoincrement, + `created_at` INTEGER not null default CURRENT_TIMESTAMP, + `created_by` ineger null, + `updated_at` INTEGER null default CURRENT_TIMESTAMP, + `updated_by` integer null, + `name` varchar(255) null, + `exchange_date` INTEGER null, + unique (`id`) + ); + + CREATE TABLE + `gift_exchange_participants` ( + `id` integer not null primary key autoincrement, + `created_at` INTEGER not null default CURRENT_TIMESTAMP, + `created_by` ineger null, + `updated_at` INTEGER null default CURRENT_TIMESTAMP, + `updated_by` integer null, + `exchange_id` INTEGER not null, + `participant_id` INTEGER not null, + `gifter_id` INTEGER null, + unique (`id`) + ); + +insert into `role_permissions` (`created_at`, `created_by`, `id`, `item`, `role_id`, `updated_at`, `updated_by`) values ('0', '0', '10', '/giftexchange', '2', '0', '0') \ No newline at end of file diff --git a/backend/src/secret_gift_exchange.rs b/backend/src/secret_gift_exchange.rs new file mode 100644 index 0000000..a5dc4cd --- /dev/null +++ b/backend/src/secret_gift_exchange.rs @@ -0,0 +1,42 @@ +/// Select participants from user list +/// create group id for exchange +/// allow user to only see their recipient but whole list of participants +/// link to recipient wish list +/// button to create selections +/// +/// Database schema +/// Table - gift_exchange +/// Columns - id -> number +/// - created_by -> number +/// - created_at -> number +/// - updated_by -> number +/// - updated_at -> number +/// - name -> text +/// - exchange_date -> number +/// +/// Table - gift_exchange_participants +/// Columns - id -> number +/// - created_by -> number +/// - created_at -> number +/// - updated_by -> number +/// - updated_at -> number +/// - exchange_id -> number (reference gift_exchange table) +/// - participant_id -> number (reference user table) +/// - gifter_id -> number (reference user table) +/// +/// Pages - sge_list +/// - list of gift exchanges user is part of +/// - sge_exchange +/// - exchange details +/// - list of participants +/// - sge_edit +/// - create new exchange +/// - edit existing exchange +/// - sge_participant_edit +/// - add or remove participant to exchange +/// +/// API - select gifters + +pub fn select_gifters() { + +}