From ad28d0f827b15968ba483e043c0aa55dc2d7798a Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Mon, 4 Apr 2022 18:50:33 +0200 Subject: [PATCH] add more squil and rename Entry to CardEntry as its child components may be useful in other contexts. --- scripts/goose-mysql/20220326173144_stat.sql | 2 +- .../goose-mysql/20220326174046_project.sql | 6 +++--- .../20220404144911_project_requirement.sql | 16 ++++++++++++++++ scripts/goose-mysql/20220404144914_item.sql | 19 +++++++++++++++++++ .../20220404144947_item_stat_progress.sql | 17 +++++++++++++++++ ...0220404184237_project_requirement_stat.sql | 15 +++++++++++++++ src/lib/components/frontpage/ItemLink.svelte | 16 ++++++++-------- .../frontpage/RequirementLink.svelte | 6 +++--- src/lib/components/frontpage/ScopeLink.svelte | 6 +++--- .../components/frontpage/SprintLink.svelte | 16 ++++++++-------- .../layout/{Entry.svelte => CardEntry.svelte} | 0 src/lib/database/mysql/database.ts | 2 +- src/lib/database/mysql/scopes.ts | 2 -- src/lib/models/item.ts | 6 ++++-- 14 files changed, 98 insertions(+), 31 deletions(-) create mode 100644 scripts/goose-mysql/20220404144911_project_requirement.sql create mode 100644 scripts/goose-mysql/20220404144914_item.sql create mode 100644 scripts/goose-mysql/20220404144947_item_stat_progress.sql create mode 100644 scripts/goose-mysql/20220404184237_project_requirement_stat.sql rename src/lib/components/layout/{Entry.svelte => CardEntry.svelte} (100%) diff --git a/scripts/goose-mysql/20220326173144_stat.sql b/scripts/goose-mysql/20220326173144_stat.sql index e915484..5daba36 100644 --- a/scripts/goose-mysql/20220326173144_stat.sql +++ b/scripts/goose-mysql/20220326173144_stat.sql @@ -14,5 +14,5 @@ CREATE TABLE stat ( -- +goose Down -- +goose StatementBegin -SELECT 'down SQL query'; +DROP TABLE IF EXISTS stat; -- +goose StatementEnd diff --git a/scripts/goose-mysql/20220326174046_project.sql b/scripts/goose-mysql/20220326174046_project.sql index 52f3287..228311b 100644 --- a/scripts/goose-mysql/20220326174046_project.sql +++ b/scripts/goose-mysql/20220326174046_project.sql @@ -1,7 +1,7 @@ -- +goose Up -- +goose StatementBegin -CREATE TABLE IF NOT EXISTS 'project' ( - `id` INT NOT NULL AUTO_INCREMENT, +CREATE TABLE project ( + `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT, `scope_id` INT NOT NULL, `author_id` CHAR(36) NOT NULL, `name` VARCHAR(255) NOT NULL, @@ -14,5 +14,5 @@ CREATE TABLE IF NOT EXISTS 'project' ( -- +goose Down -- +goose StatementBegin -SELECT 'down SQL query'; +DROP TABLE IF EXISTS project; -- +goose StatementEnd diff --git a/scripts/goose-mysql/20220404144911_project_requirement.sql b/scripts/goose-mysql/20220404144911_project_requirement.sql new file mode 100644 index 0000000..6caecfd --- /dev/null +++ b/scripts/goose-mysql/20220404144911_project_requirement.sql @@ -0,0 +1,16 @@ +-- +goose Up +-- +goose StatementBegin +CREATE TABLE project_requirement ( + `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT, + `scope_id` INT NOT NULL, + `project_id` INT NOT NULL, + `name` VARCHAR(255) NOT NULL, + `status` INT NOT NULL, + `description` TEXT NOT NULL +) +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +DROP TABLE IF EXISTS project_requirement; +-- +goose StatementEnd diff --git a/scripts/goose-mysql/20220404144914_item.sql b/scripts/goose-mysql/20220404144914_item.sql new file mode 100644 index 0000000..ea9671b --- /dev/null +++ b/scripts/goose-mysql/20220404144914_item.sql @@ -0,0 +1,19 @@ +-- +goose Up +-- +goose StatementBegin +CREATE TABLE item ( + `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT, + `scope_id` INT NOT NULL, + `project_requirement_id` INT, + `name` VARCHAR(255) NOT NULL, + `description` TEXT NOT NULL, + `created_time` DATETIME NOT NULL, + `created_user_id` CHAR(36) NOT NULL, + `acquired_time` DATETIME, + `scheduled_date` DATE +) +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +DROP TABLE IF EXISTS item; +-- +goose StatementEnd diff --git a/scripts/goose-mysql/20220404144947_item_stat_progress.sql b/scripts/goose-mysql/20220404144947_item_stat_progress.sql new file mode 100644 index 0000000..da5a666 --- /dev/null +++ b/scripts/goose-mysql/20220404144947_item_stat_progress.sql @@ -0,0 +1,17 @@ +-- +goose Up +-- +goose StatementBegin +CREATE TABLE item_stat_progress ( + `item_id` INT NOT NULL, + `stat_id` INT NOT NULL, + `acquired` INT NOT NULL, + `required` INT NOT NULL, + + PRIMARY KEY (`item_id`, `stat_id`), + UNIQUE (`stat_id`, `item_id`) +) +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +DROP TABLE IF EXISTS item_stat_progress; +-- +goose StatementEnd diff --git a/scripts/goose-mysql/20220404184237_project_requirement_stat.sql b/scripts/goose-mysql/20220404184237_project_requirement_stat.sql new file mode 100644 index 0000000..9354ab5 --- /dev/null +++ b/scripts/goose-mysql/20220404184237_project_requirement_stat.sql @@ -0,0 +1,15 @@ +-- +goose Up +-- +goose StatementBegin +CREATE TABLE project_requirement_stat ( + `project_requirement_id` INT NOT NULL, + `stat_id` INT NOT NULL, + `required` INT NOT NULL, + + PRIMARY KEY (`project_requirement_id`, `stat_id`) +) +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +DROP TABLE IF EXISTS project_requirement_stat; +-- +goose StatementEnd diff --git a/src/lib/components/frontpage/ItemLink.svelte b/src/lib/components/frontpage/ItemLink.svelte index d921788..d8b8f94 100644 --- a/src/lib/components/frontpage/ItemLink.svelte +++ b/src/lib/components/frontpage/ItemLink.svelte @@ -1,6 +1,6 @@ - - {#if !item.acquireDate} + + {#if !item.acquireTime} @@ -37,18 +37,18 @@ import EntryDate from "../layout/EntryDate.svelte"; {/if} - + {item.name} {#if !compact} - {#if !!item.acquireDate} - + {#if !!item.acquireTime} + {:else} - + {/if} {item.description} {/if} - +