From 1c773a38b1bdf076bd1caebbb90ffd08ad2c8304 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Tue, 9 Apr 2024 20:47:35 -0700 Subject: [PATCH] Revert "Add flavor profiles based on SMWS (refs GH-154)" This reverts commit ae26d1b1d611fd519fbca06b6977a65d03d26ffe. --- apps/server/migrations/0090_chilly_freak.sql | 33 - .../server/migrations/meta/0090_snapshot.json | 2218 ----------------- apps/server/migrations/meta/_journal.json | 7 - apps/server/src/constants.ts | 15 - apps/server/src/db/schema/bottles.ts | 32 +- apps/server/src/db/schema/enums.ts | 4 +- apps/server/src/db/schema/tastings.ts | 2 - apps/server/src/lib/format.ts | 36 +- apps/server/src/lib/test/fixtures.ts | 7 +- apps/server/src/schemas/bottles.ts | 6 +- apps/server/src/schemas/tastings.ts | 5 +- apps/server/src/serializers/bottle.ts | 1 - apps/server/src/serializers/tasting.ts | 1 - apps/server/src/trpc/routes/tastingCreate.ts | 1 - apps/server/src/trpc/routes/tastingUpdate.ts | 6 - apps/server/src/types.ts | 2 - apps/web/app/components/flavorProfile.tsx | 102 - apps/web/app/components/listItem.tsx | 2 +- apps/web/app/components/selectField/index.tsx | 11 +- .../components/selectField/selectDialog.tsx | 36 +- apps/web/app/components/selectField/types.tsx | 2 - apps/web/app/components/tastingForm.tsx | 83 +- apps/web/app/components/tastingListItem.tsx | 7 +- 23 files changed, 25 insertions(+), 2594 deletions(-) delete mode 100644 apps/server/migrations/0090_chilly_freak.sql delete mode 100644 apps/server/migrations/meta/0090_snapshot.json delete mode 100644 apps/web/app/components/flavorProfile.tsx diff --git a/apps/server/migrations/0090_chilly_freak.sql b/apps/server/migrations/0090_chilly_freak.sql deleted file mode 100644 index 35c4aa89c..000000000 --- a/apps/server/migrations/0090_chilly_freak.sql +++ /dev/null @@ -1,33 +0,0 @@ -DO $$ BEGIN - CREATE TYPE "flavor_profile" AS ENUM( - 'young_spritely', - 'sweet_fruit_mellow', - 'spicy_sweet', - 'spicy_dry', - 'deep_rich_dried_fruit', - 'old_dignified', - 'light_delicate', - 'juicy_oak_vanilla', - 'oily_coastal', - 'lightly_peated', - 'peated', - 'heavily_peated' -); -EXCEPTION - WHEN duplicate_object THEN null; -END $$; - -CREATE TABLE IF NOT EXISTS "bottle_flavor_profile" ( - "bottle_id" bigint NOT NULL, - "flavor_profile" "flavor_profile" NOT NULL, - "count" integer DEFAULT 0 NOT NULL, - CONSTRAINT "bottle_flavor_profile_bottle_id_flavor_profile_pk" PRIMARY KEY("bottle_id","flavor_profile") -); - -ALTER TABLE "bottle" ADD COLUMN "flavor_profile" "flavor_profile"; -ALTER TABLE "tasting" ADD COLUMN "flavor_profile" "flavor_profile"; -DO $$ BEGIN - ALTER TABLE "bottle_flavor_profile" ADD CONSTRAINT "bottle_flavor_profile_bottle_id_bottle_id_fk" FOREIGN KEY ("bottle_id") REFERENCES "bottle"("id") ON DELETE no action ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; diff --git a/apps/server/migrations/meta/0090_snapshot.json b/apps/server/migrations/meta/0090_snapshot.json deleted file mode 100644 index 97984ac68..000000000 --- a/apps/server/migrations/meta/0090_snapshot.json +++ /dev/null @@ -1,2218 +0,0 @@ -{ - "id": "3929b7da-3d1b-482f-9a96-493c3caa70cb", - "prevId": "fb8e35d3-42d8-4c9b-9b95-9b2fcb3e9693", - "version": "5", - "dialect": "pg", - "tables": { - "badge_award": { - "name": "badge_award", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "badge_id": { - "name": "badge_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "points": { - "name": "points", - "type": "smallint", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "level": { - "name": "level", - "type": "smallint", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "badge_award_unq": { - "name": "badge_award_unq", - "columns": [ - "badge_id", - "user_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "badge_award_badge_id_badges_id_fk": { - "name": "badge_award_badge_id_badges_id_fk", - "tableFrom": "badge_award", - "tableTo": "badges", - "columnsFrom": [ - "badge_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "badge_award_user_id_user_id_fk": { - "name": "badge_award_user_id_user_id_fk", - "tableFrom": "badge_award", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "badges": { - "name": "badges", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "badge_type", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - } - }, - "indexes": { - "badge_name_unq": { - "name": "badge_name_unq", - "columns": [ - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "bottle_alias": { - "name": "bottle_alias", - "schema": "", - "columns": { - "bottle_id": { - "name": "bottle_id", - "type": "bigint", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "bottle_alias_bottle_idx": { - "name": "bottle_alias_bottle_idx", - "columns": [ - "bottle_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "bottle_alias_bottle_id_bottle_id_fk": { - "name": "bottle_alias_bottle_id_bottle_id_fk", - "tableFrom": "bottle_alias", - "tableTo": "bottle", - "columnsFrom": [ - "bottle_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "bottle_alias_name_pk": { - "name": "bottle_alias_name_pk", - "columns": [ - "name" - ] - } - }, - "uniqueConstraints": {} - }, - "bottle_flavor_profile": { - "name": "bottle_flavor_profile", - "schema": "", - "columns": { - "bottle_id": { - "name": "bottle_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "flavor_profile": { - "name": "flavor_profile", - "type": "flavor_profile", - "primaryKey": false, - "notNull": true - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - } - }, - "indexes": {}, - "foreignKeys": { - "bottle_flavor_profile_bottle_id_bottle_id_fk": { - "name": "bottle_flavor_profile_bottle_id_bottle_id_fk", - "tableFrom": "bottle_flavor_profile", - "tableTo": "bottle", - "columnsFrom": [ - "bottle_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "bottle_flavor_profile_bottle_id_flavor_profile_pk": { - "name": "bottle_flavor_profile_bottle_id_flavor_profile_pk", - "columns": [ - "bottle_id", - "flavor_profile" - ] - } - }, - "uniqueConstraints": {} - }, - "bottle_tag": { - "name": "bottle_tag", - "schema": "", - "columns": { - "bottle_id": { - "name": "bottle_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "tag": { - "name": "tag", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - } - }, - "indexes": {}, - "foreignKeys": { - "bottle_tag_bottle_id_bottle_id_fk": { - "name": "bottle_tag_bottle_id_bottle_id_fk", - "tableFrom": "bottle_tag", - "tableTo": "bottle", - "columnsFrom": [ - "bottle_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "bottle_tag_bottle_id_tag_pk": { - "name": "bottle_tag_bottle_id_tag_pk", - "columns": [ - "bottle_id", - "tag" - ] - } - }, - "uniqueConstraints": {} - }, - "bottle_tombstone": { - "name": "bottle_tombstone", - "schema": "", - "columns": { - "bottle_id": { - "name": "bottle_id", - "type": "bigint", - "primaryKey": true, - "notNull": true - }, - "new_bottle_id": { - "name": "new_bottle_id", - "type": "bigint", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "bottle": { - "name": "bottle", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "full_name": { - "name": "full_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "category": { - "name": "category", - "type": "category", - "primaryKey": false, - "notNull": false - }, - "brand_id": { - "name": "brand_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "bottler_id": { - "name": "bottler_id", - "type": "bigint", - "primaryKey": false, - "notNull": false - }, - "stated_age": { - "name": "stated_age", - "type": "smallint", - "primaryKey": false, - "notNull": false - }, - "flavor_profile": { - "name": "flavor_profile", - "type": "flavor_profile", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "tasting_notes": { - "name": "tasting_notes", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "suggested_tags": { - "name": "suggested_tags", - "type": "varchar(64)[]", - "primaryKey": false, - "notNull": true, - "default": "array[]::varchar[]" - }, - "avg_rating": { - "name": "avg_rating", - "type": "double precision", - "primaryKey": false, - "notNull": false - }, - "total_tastings": { - "name": "total_tastings", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by_id": { - "name": "created_by_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "bottle_brand_unq": { - "name": "bottle_brand_unq", - "columns": [ - "name", - "brand_id" - ], - "isUnique": true - }, - "bottle_full_name_unq": { - "name": "bottle_full_name_unq", - "columns": [ - "full_name" - ], - "isUnique": true - }, - "bottle_brand_idx": { - "name": "bottle_brand_idx", - "columns": [ - "brand_id" - ], - "isUnique": false - }, - "bottle_bottler_idx": { - "name": "bottle_bottler_idx", - "columns": [ - "bottler_id" - ], - "isUnique": false - }, - "bottle_created_by_idx": { - "name": "bottle_created_by_idx", - "columns": [ - "created_by_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "bottle_brand_id_entity_id_fk": { - "name": "bottle_brand_id_entity_id_fk", - "tableFrom": "bottle", - "tableTo": "entity", - "columnsFrom": [ - "brand_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bottle_bottler_id_entity_id_fk": { - "name": "bottle_bottler_id_entity_id_fk", - "tableFrom": "bottle", - "tableTo": "entity", - "columnsFrom": [ - "bottler_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bottle_created_by_id_user_id_fk": { - "name": "bottle_created_by_id_user_id_fk", - "tableFrom": "bottle", - "tableTo": "user", - "columnsFrom": [ - "created_by_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "bottle_distiller": { - "name": "bottle_distiller", - "schema": "", - "columns": { - "bottle_id": { - "name": "bottle_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "distiller_id": { - "name": "distiller_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "bottle_distiller_bottle_id_bottle_id_fk": { - "name": "bottle_distiller_bottle_id_bottle_id_fk", - "tableFrom": "bottle_distiller", - "tableTo": "bottle", - "columnsFrom": [ - "bottle_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bottle_distiller_distiller_id_entity_id_fk": { - "name": "bottle_distiller_distiller_id_entity_id_fk", - "tableFrom": "bottle_distiller", - "tableTo": "entity", - "columnsFrom": [ - "distiller_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "bottle_distiller_bottle_id_distiller_id_pk": { - "name": "bottle_distiller_bottle_id_distiller_id_pk", - "columns": [ - "bottle_id", - "distiller_id" - ] - } - }, - "uniqueConstraints": {} - }, - "change": { - "name": "change", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "object_id": { - "name": "object_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "object_type": { - "name": "object_type", - "type": "object_type", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "type", - "primaryKey": false, - "notNull": true, - "default": "'add'" - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "data": { - "name": "data", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by_id": { - "name": "created_by_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "change_created_by_idx": { - "name": "change_created_by_idx", - "columns": [ - "created_by_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "change_created_by_id_user_id_fk": { - "name": "change_created_by_id_user_id_fk", - "tableFrom": "change", - "tableTo": "user", - "columnsFrom": [ - "created_by_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "collection_bottle": { - "name": "collection_bottle", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "collection_id": { - "name": "collection_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "bottle_id": { - "name": "bottle_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "collection_bottle_unq": { - "name": "collection_bottle_unq", - "columns": [ - "collection_id", - "bottle_id" - ], - "isUnique": true - }, - "collection_bottle_bottle_idx": { - "name": "collection_bottle_bottle_idx", - "columns": [ - "bottle_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "collection_bottle_collection_id_collection_id_fk": { - "name": "collection_bottle_collection_id_collection_id_fk", - "tableFrom": "collection_bottle", - "tableTo": "collection", - "columnsFrom": [ - "collection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "collection_bottle_bottle_id_bottle_id_fk": { - "name": "collection_bottle_bottle_id_bottle_id_fk", - "tableFrom": "collection_bottle", - "tableTo": "bottle", - "columnsFrom": [ - "bottle_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "collection": { - "name": "collection", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "total_bottles": { - "name": "total_bottles", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by_id": { - "name": "created_by_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "collection_name_unq": { - "name": "collection_name_unq", - "columns": [ - "name", - "created_by_id" - ], - "isUnique": true - }, - "collection_created_by_idx": { - "name": "collection_created_by_idx", - "columns": [ - "created_by_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "collection_created_by_id_user_id_fk": { - "name": "collection_created_by_id_user_id_fk", - "tableFrom": "collection", - "tableTo": "user", - "columnsFrom": [ - "created_by_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "comments": { - "name": "comments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "tasting_id": { - "name": "tasting_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "comment": { - "name": "comment", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by_id": { - "name": "created_by_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "comment_unq": { - "name": "comment_unq", - "columns": [ - "tasting_id", - "created_by_id", - "created_at" - ], - "isUnique": true - } - }, - "foreignKeys": { - "comments_tasting_id_tasting_id_fk": { - "name": "comments_tasting_id_tasting_id_fk", - "tableFrom": "comments", - "tableTo": "tasting", - "columnsFrom": [ - "tasting_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "comments_created_by_id_user_id_fk": { - "name": "comments_created_by_id_user_id_fk", - "tableFrom": "comments", - "tableTo": "user", - "columnsFrom": [ - "created_by_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "entity": { - "name": "entity", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "short_name": { - "name": "short_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "region": { - "name": "region", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "entity_type[]", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "year_established": { - "name": "year_established", - "type": "smallint", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "location": { - "name": "location", - "type": "geography", - "primaryKey": false, - "notNull": false - }, - "total_bottles": { - "name": "total_bottles", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "total_tastings": { - "name": "total_tastings", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by_id": { - "name": "created_by_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "entity_name_unq": { - "name": "entity_name_unq", - "columns": [ - "name" - ], - "isUnique": true - }, - "entity_created_by_idx": { - "name": "entity_created_by_idx", - "columns": [ - "created_by_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "entity_created_by_id_user_id_fk": { - "name": "entity_created_by_id_user_id_fk", - "tableFrom": "entity", - "tableTo": "user", - "columnsFrom": [ - "created_by_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "entity_tombstone": { - "name": "entity_tombstone", - "schema": "", - "columns": { - "entity_id": { - "name": "entity_id", - "type": "bigint", - "primaryKey": true, - "notNull": true - }, - "new_entity_id": { - "name": "new_entity_id", - "type": "bigint", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "external_site_config": { - "name": "external_site_config", - "schema": "", - "columns": { - "external_site_id": { - "name": "external_site_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "data": { - "name": "data", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "external_site_config_external_site_id_external_site_id_fk": { - "name": "external_site_config_external_site_id_external_site_id_fk", - "tableFrom": "external_site_config", - "tableTo": "external_site", - "columnsFrom": [ - "external_site_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "external_site_config_external_site_id_key_pk": { - "name": "external_site_config_external_site_id_key_pk", - "columns": [ - "external_site_id", - "key" - ] - } - }, - "uniqueConstraints": {} - }, - "external_site": { - "name": "external_site", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "type": { - "name": "type", - "type": "external_site_type", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_run_at": { - "name": "last_run_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "next_run_at": { - "name": "next_run_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "run_every": { - "name": "run_every", - "type": "integer", - "primaryKey": false, - "notNull": false, - "default": 60 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "external_site_type": { - "name": "external_site_type", - "columns": [ - "type" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "flight_bottle": { - "name": "flight_bottle", - "schema": "", - "columns": { - "flight_id": { - "name": "flight_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "bottle_id": { - "name": "bottle_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "flight_bottle_flight_id_flight_id_fk": { - "name": "flight_bottle_flight_id_flight_id_fk", - "tableFrom": "flight_bottle", - "tableTo": "flight", - "columnsFrom": [ - "flight_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "flight_bottle_bottle_id_bottle_id_fk": { - "name": "flight_bottle_bottle_id_bottle_id_fk", - "tableFrom": "flight_bottle", - "tableTo": "bottle", - "columnsFrom": [ - "bottle_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "flight_bottle_flight_id_bottle_id_pk": { - "name": "flight_bottle_flight_id_bottle_id_pk", - "columns": [ - "flight_id", - "bottle_id" - ] - } - }, - "uniqueConstraints": {} - }, - "flight": { - "name": "flight", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "public_id": { - "name": "public_id", - "type": "varchar(12)", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public": { - "name": "public", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by_id": { - "name": "created_by_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "flight_public_id": { - "name": "flight_public_id", - "columns": [ - "public_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "flight_created_by_id_user_id_fk": { - "name": "flight_created_by_id_user_id_fk", - "tableFrom": "flight", - "tableTo": "user", - "columnsFrom": [ - "created_by_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "follow": { - "name": "follow", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "from_user_id": { - "name": "from_user_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "to_user_id": { - "name": "to_user_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "follow_status", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follow_unq": { - "name": "follow_unq", - "columns": [ - "from_user_id", - "to_user_id" - ], - "isUnique": true - }, - "follow_to_user_idx": { - "name": "follow_to_user_idx", - "columns": [ - "to_user_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "follow_from_user_id_user_id_fk": { - "name": "follow_from_user_id_user_id_fk", - "tableFrom": "follow", - "tableTo": "user", - "columnsFrom": [ - "from_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "follow_to_user_id_user_id_fk": { - "name": "follow_to_user_id_user_id_fk", - "tableFrom": "follow", - "tableTo": "user", - "columnsFrom": [ - "to_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "identity": { - "name": "identity", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "identity_provider", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "identity_unq": { - "name": "identity_unq", - "columns": [ - "provider", - "external_id" - ], - "isUnique": true - }, - "identity_user_idx": { - "name": "identity_user_idx", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "identity_user_id_user_id_fk": { - "name": "identity_user_id_user_id_fk", - "tableFrom": "identity", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "from_user_id": { - "name": "from_user_id", - "type": "bigint", - "primaryKey": false, - "notNull": false - }, - "object_id": { - "name": "object_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "notification_type", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "read": { - "name": "read", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - } - }, - "indexes": { - "notifications_unq": { - "name": "notifications_unq", - "columns": [ - "user_id", - "object_id", - "type", - "created_at" - ], - "isUnique": true - } - }, - "foreignKeys": { - "notifications_user_id_user_id_fk": { - "name": "notifications_user_id_user_id_fk", - "tableFrom": "notifications", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "notifications_from_user_id_user_id_fk": { - "name": "notifications_from_user_id_user_id_fk", - "tableFrom": "notifications", - "tableTo": "user", - "columnsFrom": [ - "from_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "review": { - "name": "review", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "external_site_id": { - "name": "external_site_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "bottle_id": { - "name": "bottle_id", - "type": "bigint", - "primaryKey": false, - "notNull": false - }, - "rating": { - "name": "rating", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "issue": { - "name": "issue", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "review_unq_name": { - "name": "review_unq_name", - "columns": [ - "external_site_id", - "name", - "issue" - ], - "isUnique": true - }, - "review_bottle_idx": { - "name": "review_bottle_idx", - "columns": [ - "bottle_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "review_external_site_id_external_site_id_fk": { - "name": "review_external_site_id_external_site_id_fk", - "tableFrom": "review", - "tableTo": "external_site", - "columnsFrom": [ - "external_site_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "review_bottle_id_bottle_id_fk": { - "name": "review_bottle_id_bottle_id_fk", - "tableFrom": "review", - "tableTo": "bottle", - "columnsFrom": [ - "bottle_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "review_url_unique": { - "name": "review_url_unique", - "nullsNotDistinct": false, - "columns": [ - "url" - ] - } - } - }, - "store_price_history": { - "name": "store_price_history", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "price_id": { - "name": "price_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "price": { - "name": "price", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "volume": { - "name": "volume", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "date": { - "name": "date", - "type": "date", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "store_price_history_unq": { - "name": "store_price_history_unq", - "columns": [ - "price_id", - "volume", - "date" - ], - "isUnique": true - } - }, - "foreignKeys": { - "store_price_history_price_id_store_price_id_fk": { - "name": "store_price_history_price_id_store_price_id_fk", - "tableFrom": "store_price_history", - "tableTo": "store_price", - "columnsFrom": [ - "price_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "store_price": { - "name": "store_price", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "external_site_id": { - "name": "external_site_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "bottle_id": { - "name": "bottle_id", - "type": "bigint", - "primaryKey": false, - "notNull": false - }, - "price": { - "name": "price", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "volume": { - "name": "volume", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "store_price_unq_name": { - "name": "store_price_unq_name", - "columns": [ - "external_site_id", - "name", - "volume" - ], - "isUnique": true - }, - "store_price_bottle_idx": { - "name": "store_price_bottle_idx", - "columns": [ - "bottle_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "store_price_external_site_id_external_site_id_fk": { - "name": "store_price_external_site_id_external_site_id_fk", - "tableFrom": "store_price", - "tableTo": "external_site", - "columnsFrom": [ - "external_site_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "store_price_bottle_id_bottle_id_fk": { - "name": "store_price_bottle_id_bottle_id_fk", - "tableFrom": "store_price", - "tableTo": "bottle", - "columnsFrom": [ - "bottle_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "store_price_url_unique": { - "name": "store_price_url_unique", - "nullsNotDistinct": false, - "columns": [ - "url" - ] - } - } - }, - "tasting": { - "name": "tasting", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "bottle_id": { - "name": "bottle_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "tags": { - "name": "tags", - "type": "varchar(64)[]", - "primaryKey": false, - "notNull": true, - "default": "array[]::varchar[]" - }, - "flavor_profile": { - "name": "flavor_profile", - "type": "flavor_profile", - "primaryKey": false, - "notNull": false - }, - "rating": { - "name": "rating", - "type": "double precision", - "primaryKey": false, - "notNull": false - }, - "image_url": { - "name": "image_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "serving_style": { - "name": "serving_style", - "type": "servingStyle", - "primaryKey": false, - "notNull": false - }, - "friends": { - "name": "friends", - "type": "bigint[]", - "primaryKey": false, - "notNull": true, - "default": "array[]::bigint[]" - }, - "flight_id": { - "name": "flight_id", - "type": "bigint", - "primaryKey": false, - "notNull": false - }, - "comments": { - "name": "comments", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "toasts": { - "name": "toasts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by_id": { - "name": "created_by_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "tasting_unq": { - "name": "tasting_unq", - "columns": [ - "bottle_id", - "created_by_id", - "created_at" - ], - "isUnique": true - }, - "tasting_bottle_idx": { - "name": "tasting_bottle_idx", - "columns": [ - "bottle_id" - ], - "isUnique": false - }, - "tasting_flight_idx": { - "name": "tasting_flight_idx", - "columns": [ - "flight_id" - ], - "isUnique": false - }, - "tasting_created_by_idx": { - "name": "tasting_created_by_idx", - "columns": [ - "created_by_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tasting_bottle_id_bottle_id_fk": { - "name": "tasting_bottle_id_bottle_id_fk", - "tableFrom": "tasting", - "tableTo": "bottle", - "columnsFrom": [ - "bottle_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tasting_flight_id_flight_id_fk": { - "name": "tasting_flight_id_flight_id_fk", - "tableFrom": "tasting", - "tableTo": "flight", - "columnsFrom": [ - "flight_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tasting_created_by_id_user_id_fk": { - "name": "tasting_created_by_id_user_id_fk", - "tableFrom": "tasting", - "tableTo": "user", - "columnsFrom": [ - "created_by_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "toasts": { - "name": "toasts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "tasting_id": { - "name": "tasting_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by_id": { - "name": "created_by_id", - "type": "bigint", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "toast_unq": { - "name": "toast_unq", - "columns": [ - "tasting_id", - "created_by_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "toasts_tasting_id_tasting_id_fk": { - "name": "toasts_tasting_id_tasting_id_fk", - "tableFrom": "toasts", - "tableTo": "tasting", - "columnsFrom": [ - "tasting_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "toasts_created_by_id_user_id_fk": { - "name": "toasts_created_by_id_user_id_fk", - "tableFrom": "toasts", - "tableTo": "user", - "columnsFrom": [ - "created_by_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "username": { - "name": "username", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "password_hash": { - "name": "password_hash", - "type": "varchar(256)", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "picture_url": { - "name": "picture_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private": { - "name": "private", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "active": { - "name": "active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "admin": { - "name": "admin", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "mod": { - "name": "mod", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "user_email_unq": { - "name": "user_email_unq", - "columns": [ - "email" - ], - "isUnique": true - }, - "user_username_unq": { - "name": "user_username_unq", - "columns": [ - "username" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": { - "badge_type": { - "name": "badge_type", - "values": { - "bottle": "bottle", - "region": "region", - "category": "category" - } - }, - "type": { - "name": "type", - "values": { - "add": "add", - "update": "update", - "delete": "delete" - } - }, - "entity_type": { - "name": "entity_type", - "values": { - "brand": "brand", - "distiller": "distiller", - "bottler": "bottler" - } - }, - "external_site_type": { - "name": "external_site_type", - "values": { - "astorwines": "astorwines", - "healthyspirits": "healthyspirits", - "smws": "smws", - "smwsa": "smwsa", - "totalwine": "totalwine", - "woodencork": "woodencork", - "whiskyadvocate": "whiskyadvocate" - } - }, - "follow_status": { - "name": "follow_status", - "values": { - "none": "none", - "pending": "pending", - "following": "following" - } - }, - "identity_provider": { - "name": "identity_provider", - "values": { - "google": "google" - } - }, - "notification_type": { - "name": "notification_type", - "values": { - "comment": "comment", - "toast": "toast", - "friend_request": "friend_request" - } - }, - "servingStyle": { - "name": "servingStyle", - "values": { - "neat": "neat", - "rocks": "rocks", - "splash": "splash" - } - } - }, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/apps/server/migrations/meta/_journal.json b/apps/server/migrations/meta/_journal.json index b84d576bc..148219f50 100644 --- a/apps/server/migrations/meta/_journal.json +++ b/apps/server/migrations/meta/_journal.json @@ -631,13 +631,6 @@ "when": 1710295282439, "tag": "0089_funny_miracleman", "breakpoints": false - }, - { - "idx": 90, - "version": "5", - "when": 1712712679180, - "tag": "0090_chilly_freak", - "breakpoints": false } ] } \ No newline at end of file diff --git a/apps/server/src/constants.ts b/apps/server/src/constants.ts index 20096e3c3..c3d6850bd 100644 --- a/apps/server/src/constants.ts +++ b/apps/server/src/constants.ts @@ -4,21 +4,6 @@ export const MAX_FILESIZE = 1048576 * 20; export const XP_PER_LEVEL = 5; -export const FLAVOR_PROFILES = [ - "young_spritely", - "sweet_fruit_mellow", - "spicy_sweet", - "spicy_dry", - "deep_rich_dried_fruit", - "old_dignified", - "light_delicate", - "juicy_oak_vanilla", - "oily_coastal", - "lightly_peated", - "peated", - "heavily_peated", -] as const; - export const COUNTRY_LIST = [ "Afghanistan", "Albania", diff --git a/apps/server/src/db/schema/bottles.ts b/apps/server/src/db/schema/bottles.ts index dda2d95df..e5e138a60 100644 --- a/apps/server/src/db/schema/bottles.ts +++ b/apps/server/src/db/schema/bottles.ts @@ -16,7 +16,7 @@ import { } from "drizzle-orm/pg-core"; import { entities } from "./entities"; -import { categoryEnum, flavorProfileEnum } from "./enums"; +import { categoryEnum } from "./enums"; import { users } from "./users"; type TastingNotes = { @@ -39,7 +39,6 @@ export const bottles = pgTable( () => entities.id, ), statedAge: smallint("stated_age"), - flavorProfile: flavorProfileEnum("flavor_profile"), description: text("description"), tastingNotes: jsonb("tasting_notes").$type(), @@ -200,32 +199,3 @@ export const bottleTombstonesRelations = relations( export type BottleTombstone = typeof bottleTombstones.$inferSelect; export type NewBottleTombstone = typeof bottleTombstones.$inferInsert; - -export const bottleFlavorProfiles = pgTable( - "bottle_flavor_profile", - { - bottleId: bigint("bottle_id", { mode: "number" }) - .references(() => bottles.id) - .notNull(), - flavor_profile: flavorProfileEnum("flavor_profile").notNull(), - count: integer("count").default(0).notNull(), - }, - (bottleTags) => { - return { - pk: primaryKey(bottleTags.bottleId, bottleTags.flavor_profile), - }; - }, -); - -export const bottleFlavorProfilesRelations = relations( - bottleFlavorProfiles, - ({ one }) => ({ - bottle: one(bottles, { - fields: [bottleFlavorProfiles.bottleId], - references: [bottles.id], - }), - }), -); - -export type BottleFlavorProfile = typeof bottleFlavorProfiles.$inferSelect; -export type NewBottleFlavorProfile = typeof bottleFlavorProfiles.$inferInsert; diff --git a/apps/server/src/db/schema/enums.ts b/apps/server/src/db/schema/enums.ts index aad7ce2db..ac8b4b6bd 100644 --- a/apps/server/src/db/schema/enums.ts +++ b/apps/server/src/db/schema/enums.ts @@ -1,6 +1,6 @@ import { pgEnum } from "drizzle-orm/pg-core"; -import { CATEGORY_LIST, FLAVOR_PROFILES } from "../../constants"; +import { CATEGORY_LIST } from "../../constants"; export const categoryEnum = pgEnum("category", CATEGORY_LIST); @@ -12,5 +12,3 @@ export const objectTypeEnum = pgEnum("object_type", [ "toast", "follow", ]); - -export const flavorProfileEnum = pgEnum("flavor_profile", FLAVOR_PROFILES); diff --git a/apps/server/src/db/schema/tastings.ts b/apps/server/src/db/schema/tastings.ts index 1bf8343dd..20829b0a9 100644 --- a/apps/server/src/db/schema/tastings.ts +++ b/apps/server/src/db/schema/tastings.ts @@ -15,7 +15,6 @@ import { import { SERVING_STYLE_LIST } from "../../constants"; import { bottles } from "./bottles"; -import { flavorProfileEnum } from "./enums"; import { flights } from "./flights"; import { users } from "./users"; @@ -33,7 +32,6 @@ export const tastings = pgTable( .array() .default(sql`array[]::varchar[]`) .notNull(), - flavorProfile: flavorProfileEnum("flavor_profile"), rating: doublePrecision("rating"), imageUrl: text("image_url"), notes: text("notes"), diff --git a/apps/server/src/lib/format.ts b/apps/server/src/lib/format.ts index 0c024b806..8ed4dea0f 100644 --- a/apps/server/src/lib/format.ts +++ b/apps/server/src/lib/format.ts @@ -1,5 +1,5 @@ import { toTitleCase } from "@peated/server/lib/strings"; -import type { Category, FlavorProfile } from "@peated/server/types"; +import type { Category } from "@peated/server/types"; export function formatCategoryName( value: Category | string | undefined | null, @@ -7,37 +7,3 @@ export function formatCategoryName( if (!value) return ""; return toTitleCase(`${value}`.replace(/_/g, " ")); } - -export function formatFlavorProfile( - value: FlavorProfile | string | undefined | null, -) { - if (!value) return ""; - switch (value) { - case "young_spritely": - return "Young & Spritely"; - case "sweet_fruit_mellow": - return "Sweet, Fruity & Mellow"; - case "spicy_sweet": - return "Spicy & Sweet"; - case "spicy_dry": - return "Spicy & Dry"; - case "deep_rich_dried_fruit": - return "Deep, Rich & Dried Fruits"; - case "old_dignified": - return "Old & Dignified"; - case "light_delicate": - return "Light & Delicate"; - case "juicy_oak_vanilla": - return "Juicy, Oak & Vanilla"; - case "oily_coastal": - return "Oily & Coastal"; - case "lightly_peated": - return "Lightly Peated"; - case "peated": - return "Peated"; - case "heavily_peated": - return "Heavily Peated"; - default: - return toTitleCase(`${value}`.replace(/_/g, " ")); - } -} diff --git a/apps/server/src/lib/test/fixtures.ts b/apps/server/src/lib/test/fixtures.ts index 0720ac2a7..9bb06a8a8 100644 --- a/apps/server/src/lib/test/fixtures.ts +++ b/apps/server/src/lib/test/fixtures.ts @@ -425,8 +425,7 @@ export const StorePrice = async ( } if (!data.price) - data.price = - parseInt(faker.finance.amount({ min: 50, max: 200, dec: 0 }), 10) * 100; + data.price = parseInt(faker.finance.amount(50, 200, 0), 10) * 100; if (!data.url) data.url = faker.internet.url(); const [price] = await tx @@ -479,9 +478,7 @@ export const StorePriceHistory = async ( return await tx .insert(storePriceHistories) .values({ - price: - parseInt(faker.finance.amount({ min: 50, max: 200, dec: 0 }), 10) * - 100, + price: parseInt(faker.finance.amount(50, 200, 0), 10) * 100, volume: 750, ...data, priceId: data.priceId || (await StorePrice({}, tx)).id, diff --git a/apps/server/src/schemas/bottles.ts b/apps/server/src/schemas/bottles.ts index 013d8a0fd..3576f7702 100644 --- a/apps/server/src/schemas/bottles.ts +++ b/apps/server/src/schemas/bottles.ts @@ -1,12 +1,10 @@ import { z } from "zod"; -import { CATEGORY_LIST, FLAVOR_PROFILES } from "../constants"; +import { CATEGORY_LIST } from "../constants"; import { EntityInputSchema, EntitySchema } from "./entities"; import { UserSchema } from "./users"; export const CategoryEnum = z.enum(CATEGORY_LIST); -export const FlavorProfileEnum = z.enum(FLAVOR_PROFILES); - export const BottleSchema = z.object({ id: z.number(), name: z.string().trim().min(1, "Required"), @@ -21,7 +19,6 @@ export const BottleSchema = z.object({ .nullable() .optional(), suggestedTags: z.array(z.string()).optional(), - flavorProfile: FlavorProfileEnum.nullable(), brand: EntitySchema, distillers: z.array(EntitySchema), bottler: EntitySchema.nullable(), @@ -41,7 +38,6 @@ export const BottleSchema = z.object({ export const BottleInputSchema = z.object({ name: z.string().trim().min(1, "Required"), brand: z.union([EntityInputSchema, z.number()]), - // flavorProfile: FlavorProfileEnum.nullable().optional(), distillers: z.array(z.union([EntityInputSchema, z.number()])).optional(), bottler: z.union([EntityInputSchema, z.number()]).nullable().optional(), statedAge: z.number().gte(0).lte(100).nullable().optional(), diff --git a/apps/server/src/schemas/tastings.ts b/apps/server/src/schemas/tastings.ts index 1e5d3b5fb..7c75e44aa 100644 --- a/apps/server/src/schemas/tastings.ts +++ b/apps/server/src/schemas/tastings.ts @@ -1,6 +1,6 @@ import { z } from "zod"; import { SERVING_STYLE_LIST } from "../constants"; -import { BottleSchema, FlavorProfileEnum } from "./bottles"; +import { BottleSchema } from "./bottles"; import { UserSchema } from "./users"; export const ServiceStyleEnum = z.enum(SERVING_STYLE_LIST); @@ -12,7 +12,6 @@ export const TastingSchema = z.object({ bottle: BottleSchema, rating: z.number().gte(0).lte(5).nullable(), tags: z.array(z.string()), - flavorProfile: FlavorProfileEnum.nullable(), servingStyle: ServiceStyleEnum.nullable(), friends: z.array(UserSchema), @@ -28,8 +27,6 @@ export const TastingInputSchema = z.object({ notes: z.string().nullable().optional(), rating: z.number().gte(0).lte(5).nullable().optional(), tags: z.array(z.string()).max(15).nullable().optional(), - flavorProfile: FlavorProfileEnum.nullable().optional(), - servingStyle: ServiceStyleEnum.nullable().optional(), friends: z.array(z.number()).optional(), flight: z.string().nullable().optional(), diff --git a/apps/server/src/serializers/bottle.ts b/apps/server/src/serializers/bottle.ts index ac100d071..169df2f19 100644 --- a/apps/server/src/serializers/bottle.ts +++ b/apps/server/src/serializers/bottle.ts @@ -154,7 +154,6 @@ export const BottleSerializer = serializer({ name: item.name, fullName: item.fullName, description: item.description, - flavorProfile: item.flavorProfile, tastingNotes: item.tastingNotes, statedAge: item.statedAge, category: item.category, diff --git a/apps/server/src/serializers/tasting.ts b/apps/server/src/serializers/tasting.ts index ba67a9188..e79ad32ad 100644 --- a/apps/server/src/serializers/tasting.ts +++ b/apps/server/src/serializers/tasting.ts @@ -109,7 +109,6 @@ export const TastingSerializer = serializer({ imageUrl: item.imageUrl ? `${config.API_SERVER}${item.imageUrl}` : null, notes: item.notes, tags: item.tags || [], - flavorProfile: item.flavorProfile, rating: item.rating, servingStyle: item.servingStyle, friends: attrs.friends, diff --git a/apps/server/src/trpc/routes/tastingCreate.ts b/apps/server/src/trpc/routes/tastingCreate.ts index 1b3ce1ddf..0296751a3 100644 --- a/apps/server/src/trpc/routes/tastingCreate.ts +++ b/apps/server/src/trpc/routes/tastingCreate.ts @@ -76,7 +76,6 @@ export default authedProcedure tags: input.tags ? Array.from(new Set(input.tags.map((t) => t.toLowerCase()))) : [], - flavorProfile: input.flavorProfile, createdById: ctx.user.id, }; if (input.createdAt) { diff --git a/apps/server/src/trpc/routes/tastingUpdate.ts b/apps/server/src/trpc/routes/tastingUpdate.ts index 761f7162b..746e079b0 100644 --- a/apps/server/src/trpc/routes/tastingUpdate.ts +++ b/apps/server/src/trpc/routes/tastingUpdate.ts @@ -46,12 +46,6 @@ export default authedProcedure if (input.rating !== undefined && input.rating !== tasting.rating) { tastingData.rating = input.rating; } - if ( - input.flavorProfile !== undefined && - input.flavorProfile !== tasting.flavorProfile - ) { - tastingData.flavorProfile = input.flavorProfile; - } if ( input.servingStyle !== undefined && input.servingStyle !== tasting.servingStyle diff --git a/apps/server/src/types.ts b/apps/server/src/types.ts index 04cb32309..5ac8091c5 100644 --- a/apps/server/src/types.ts +++ b/apps/server/src/types.ts @@ -4,7 +4,6 @@ import type { CATEGORY_LIST, COUNTRY_LIST, EXTERNAL_SITE_TYPE_LIST, - FLAVOR_PROFILES, SERVING_STYLE_LIST, } from "./constants"; import type { @@ -33,7 +32,6 @@ import type { export type Category = (typeof CATEGORY_LIST)[number]; export type ServingStyle = (typeof SERVING_STYLE_LIST)[number]; -export type FlavorProfile = (typeof FLAVOR_PROFILES)[number]; export type ExternalSiteType = (typeof EXTERNAL_SITE_TYPE_LIST)[number]; export type Country = (typeof COUNTRY_LIST)[number]; export type BadgeType = (typeof BADGE_TYPE_LIST)[number]; diff --git a/apps/web/app/components/flavorProfile.tsx b/apps/web/app/components/flavorProfile.tsx deleted file mode 100644 index 53d01696f..000000000 --- a/apps/web/app/components/flavorProfile.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import { type ComponentPropsWithoutRef } from "react"; -import { formatFlavorProfile } from "../../../server/src/lib/format"; -import { type FlavorProfile } from "../../../server/src/types"; - -export default ({ - profile, - ...props -}: { profile: FlavorProfile | string } & ComponentPropsWithoutRef<"div">) => { - const classes = classesForProfile(profile); - return ( - - {formatFlavorProfile(profile)} - - ); -}; - -export function classesForProfile(profile: FlavorProfile | string): { - bg: string; - bgHover: string; - light: string; -} { - switch (profile) { - case "young_spritely": - return { - bg: "bg-pink-600", - bgHover: "hover:bg-pink-500", - light: "text-pink-200", - }; - case "sweet_fruit_mellow": - return { - bg: "bg-fuchsia-600", - bgHover: "hover:bg-fuchsia-500", - light: "text-fuchsia-200", - }; - case "spicy_sweet": - return { - bg: "bg-violet-600", - bgHover: "hover:bg-violet-500", - light: "text-violet-200", - }; - case "spicy_dry": - return { - bg: "bg-yellow-600", - bgHover: "hover:bg-yellow-500", - light: "text-yellow-200", - }; - case "deep_rich_dried_fruit": - return { - bg: "bg-orange-600", - bgHover: "hover:bg-orange-500", - light: "text-orange-200", - }; - case "old_dignified": - return { - bg: "bg-red-600", - bgHover: "hover:bg-red-500", - light: "text-red-200", - }; - case "light_delicate": - return { - bg: "bg-sky-600", - bgHover: "hover:bg-sky-500", - light: "text-sky-200", - }; - case "juicy_oak_vanilla": - return { - bg: "bg-cyan-600", - bgHover: "hover:bg-cyan-500", - light: "text-cyan-200", - }; - case "oily_coastal": - return { - bg: "bg-blue-600", - bgHover: "hover:bg-blue-500", - light: "text-blue-200", - }; - case "lightly_peated": - return { - bg: "bg-emerald-600", - bgHover: "hover:bg-emerald-500", - light: "text-emerald-200", - }; - case "peated": - return { - bg: "bg-green-600", - bgHover: "hover:bg-green-500", - light: "text-green-200", - }; - case "heavily_peated": - return { - bg: "bg-lime-600", - bgHover: "hover:bg-lime-500", - light: "text-lime-200", - }; - default: - return { - bg: "", - bgHover: "", - light: "", - }; - } -} diff --git a/apps/web/app/components/listItem.tsx b/apps/web/app/components/listItem.tsx index 9e7f93d7d..e995cbc8e 100644 --- a/apps/web/app/components/listItem.tsx +++ b/apps/web/app/components/listItem.tsx @@ -29,7 +29,7 @@ export default function ListItem< )} {...props} > -
+
{children}
diff --git a/apps/web/app/components/selectField/index.tsx b/apps/web/app/components/selectField/index.tsx index 221b99e3e..32e4fd77f 100644 --- a/apps/web/app/components/selectField/index.tsx +++ b/apps/web/app/components/selectField/index.tsx @@ -6,13 +6,7 @@ import Chip from "../chip"; import FormField from "../formField"; import { filterDupes } from "./helpers"; import SelectDialog from "./selectDialog"; -import type { - CreateOptionForm, - OnQuery, - OnRenderOption, - OnResults, - Option, -} from "./types"; +import type { CreateOptionForm, OnQuery, OnResults, Option } from "./types"; type BaseProps = { name?: string; @@ -47,7 +41,6 @@ type OptionProps = { onResults?: OnResults; // or fixed value options?: Option[]; - onRenderOption?: OnRenderOption; // static suggestions can also be provided suggestedOptions?: Option[]; // maximum number of options to backfill with suggestions @@ -80,7 +73,6 @@ export default ({ onQuery, onResults, options = [], - onRenderOption, onChange, error, ...props @@ -201,7 +193,6 @@ export default ({ onQuery={onQuery} onResults={onResults} options={options} - onRenderOption={onRenderOption} /> ); diff --git a/apps/web/app/components/selectField/selectDialog.tsx b/apps/web/app/components/selectField/selectDialog.tsx index e02255db4..65ce41920 100644 --- a/apps/web/app/components/selectField/selectDialog.tsx +++ b/apps/web/app/components/selectField/selectDialog.tsx @@ -3,7 +3,6 @@ import { CheckIcon, PlusIcon, XMarkIcon } from "@heroicons/react/20/solid"; import { toTitleCase } from "@peated/server/lib/strings"; import config from "@peated/web/config"; import classNames from "@peated/web/lib/classNames"; -import { motion } from "framer-motion"; import { useEffect, useState } from "react"; import { debounce } from "ts-debounce"; import ListItem from "../listItem"; @@ -14,7 +13,6 @@ import type { CreateOptionForm, EndpointOptions, OnQuery, - OnRenderOption, OnResults, } from "./types"; @@ -37,7 +35,6 @@ export default ({ onQuery, onResults, options, - onRenderOption, }: { open: boolean; setOpen: (value: boolean) => void; @@ -51,7 +48,6 @@ export default ({ endpoint?: EndpointOptions; onResults?: OnResults; options?: Option[]; - onRenderOption?: OnRenderOption; }) => { const [query, setQuery] = useState(""); const [optionList, setOptionList] = useState([...selectedValues]); @@ -112,26 +108,20 @@ export default ({
-
    +
      {optionList.map((option) => { return ( - - {multiple && ( - i.id == option.id && i.name == option.name, - ) - ? "bg-highlight text-black" - : "text-light bg-slate-900 group-hover:bg-slate-800", - )} - /> - )} + + i.id == option.id && i.name == option.name, + ) + ? "bg-highlight text-black" + : "text-light bg-slate-900 group-hover:bg-slate-800", + )} + />
      @@ -141,7 +131,7 @@ export default ({ }} > - {onRenderOption ? onRenderOption(option) : option.name} + {option.name}
      diff --git a/apps/web/app/components/selectField/types.tsx b/apps/web/app/components/selectField/types.tsx index d6d5fb0bf..f6b93da3e 100644 --- a/apps/web/app/components/selectField/types.tsx +++ b/apps/web/app/components/selectField/types.tsx @@ -28,5 +28,3 @@ export type EndpointOptions = export type OnResults = (results: any[]) => Option[]; export type OnQuery = (query: string) => Promise; - -export type OnRenderOption = (option: Option) => ReactNode; diff --git a/apps/web/app/components/tastingForm.tsx b/apps/web/app/components/tastingForm.tsx index 491cdf5df..def4871d1 100644 --- a/apps/web/app/components/tastingForm.tsx +++ b/apps/web/app/components/tastingForm.tsx @@ -1,9 +1,8 @@ import { zodResolver } from "@hookform/resolvers/zod"; -import { FLAVOR_PROFILES, SERVING_STYLE_LIST } from "@peated/server/constants"; +import { SERVING_STYLE_LIST } from "@peated/server/constants"; import { toTitleCase } from "@peated/server/lib/strings"; import { TastingInputSchema } from "@peated/server/schemas"; import type { - FlavorProfile, Paginated, ServingStyle, Tag, @@ -27,9 +26,7 @@ import { useState } from "react"; import type { SubmitHandler } from "react-hook-form"; import { Controller, useForm } from "react-hook-form"; import type { z } from "zod"; -import { formatFlavorProfile } from "../../../server/src/lib/format"; import { isTRPCClientError, trpc } from "../lib/trpc"; -import { classesForProfile } from "./flavorProfile"; import Form from "./form"; type FormSchemaType = z.infer; @@ -38,47 +35,11 @@ function formatServingStyle(style: ServingStyle) { return toTitleCase(style); } -function notesForProfile(profile: FlavorProfile): string { - switch (profile) { - case "young_spritely": - return "Vibrant and youthful, bursting with lively essence and energy."; - case "sweet_fruit_mellow": - return "Defined by sweet and fruity undertones, often presenting a smooth and mellow disposition."; - case "spicy_sweet": - return "Balancing the interplay of spiciness and sweetness for a dynamic sensory experience."; - case "spicy_dry": - return "Prioritizing spicier and peppery tones within its profile."; - case "deep_rich_dried_fruit": - return "Delving into deep, rich essences reminiscent of dried fruits with a robust sweetness."; - case "old_dignified": - return "Typically older, showcasing mature and complex nuances."; - case "light_delicate": - return "Characterized by gentle essences and a delicate touch."; - case "juicy_oak_vanilla": - return "Revealing notes of fruitiness combined with distinct characters of oak and vanilla."; - case "oily_coastal": - return "Reflecting maritime influences, often marked by an oily texture."; - case "lightly_peated": - return "With a discreet presence of peat smoke, gently accentuating the spectrum without overwhelming."; - case "peated": - return "Where the influence of peat smoke is noticeable, offering more intensity than its lightly peated counterparts."; - case "heavily_peated": - return "Bold and dominant with peat smoke character, standing at the forefront of its essence."; - default: - return ""; - } -} - const servingStyleList = SERVING_STYLE_LIST.map((c) => ({ id: c, name: formatServingStyle(c), })); -const flavorProfileList = FLAVOR_PROFILES.map((c) => ({ - id: c, - name: formatFlavorProfile(c), -})); - const userToOption = (user: User): Option => { return { id: user.id, @@ -113,7 +74,6 @@ export default function TastingForm({ rating: initialData.rating, notes: initialData.notes, tags: initialData.tags, - flavorProfile: initialData.flavorProfile, servingStyle: initialData.servingStyle, friends: initialData.friends ? initialData.friends.map((d) => d.id) : [], }, @@ -185,45 +145,6 @@ export default function TastingForm({ )} /> - ( - { - const classes = classesForProfile(option.id as FlavorProfile); - return ( -
      -

      - {option.name} -

      -
      - {notesForProfile(option.id as FlavorProfile)} -
      -
      - ); - }} - options={flavorProfileList} - onChange={(value) => onChange(value?.id)} - value={ - value - ? { - id: value, - name: formatFlavorProfile(value), - } - : undefined - } - /> - )} - /> - ({ id: t.tag, diff --git a/apps/web/app/components/tastingListItem.tsx b/apps/web/app/components/tastingListItem.tsx index fec72a826..4f84a4d78 100644 --- a/apps/web/app/components/tastingListItem.tsx +++ b/apps/web/app/components/tastingListItem.tsx @@ -13,7 +13,6 @@ import { trpc } from "@peated/web/lib/trpc"; import { useEffect, type ComponentPropsWithoutRef } from "react"; import BottleCard from "./bottleCard"; import Button from "./button"; -import FlavorProfile from "./flavorProfile"; import { ImageModal } from "./imageModal"; import { StaticRating } from "./rating"; import ShareButton from "./shareButton"; @@ -107,11 +106,7 @@ export default function TastingListItem({ {tasting.rating && ( )} - {tasting.flavorProfile ? ( - - ) : ( - - )} + {!noBottle && }