+
+
+
+
+ {#each daysOfWeek as day, index (index)}
+
+
+
+ updateTimes(index)}
+ />
+ to
+ updateTimes(index)}
+ />
+
+
+ {/each}
+
{#each studySpaceData.tags as tagName (tagName)}
@@ -488,4 +570,36 @@
.additionalImages input {
display: none;
}
+
+ /* Opening times layout and inputs styling */
+ .opening-times {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5rem;
+ }
+
+ .opening-time-item {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ }
+
+ .opening-time-item label {
+ margin-top: 0;
+ width: 6rem;
+ }
+
+ .opening-time-item input[type="time"] {
+ padding: 0.5rem;
+ height: 2.5rem;
+ border-radius: 0.5rem;
+ border: 2px solid #eaffeb;
+ background: none;
+ color: #eaffeb;
+ }
+
+ .opening-time-item span {
+ margin: 0 0.5rem;
+ color: #eaffeb;
+ }
diff --git a/supabase/migrations/20250612032104_study_space_hours_table.sql b/supabase/migrations/20250612032104_study_space_hours_table.sql
new file mode 100644
index 0000000..6020722
--- /dev/null
+++ b/supabase/migrations/20250612032104_study_space_hours_table.sql
@@ -0,0 +1,14 @@
+CREATE TABLE study_space_hours (
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
+ study_space_id UUID REFERENCES study_spaces(id) ON DELETE CASCADE,
+ day_of_week INT CHECK (day_of_week BETWEEN 0 AND 6), -- 0 = Sunday, 6 = Saturday
+ opens_at TIME NOT NULL,
+ closes_at TIME NOT NULL,
+ is_24_7 BOOLEAN DEFAULT FALSE,
+ created_at timestamp with time zone DEFAULT now(),
+ updated_at timestamp with time zone DEFAULT now()
+);
+
+CREATE TRIGGER study_space_hours_updated_at
+AFTER UPDATE ON study_space_hours
+FOR EACH ROW EXECUTE FUNCTION handle_updated_at();
\ No newline at end of file
diff --git a/supabase/schemas/0001_study_spaces.sql b/supabase/schemas/0001_study_spaces.sql
index 134ff96..6ccdccd 100644
--- a/supabase/schemas/0001_study_spaces.sql
+++ b/supabase/schemas/0001_study_spaces.sql
@@ -18,6 +18,7 @@ CREATE TABLE study_spaces (
volume text NOT NULL,
wifi text NOT NULL,
power text NOT NULL,
+
created_at timestamp with time zone DEFAULT now(),
updated_at timestamp with time zone DEFAULT now()
);
@@ -39,6 +40,17 @@ CREATE TABLE reports (
content text
);
+CREATE TABLE study_space_hours (
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
+ study_space_id UUID REFERENCES study_spaces(id) ON DELETE CASCADE,
+ day_of_week INT CHECK (day_of_week BETWEEN 0 AND 6), -- 0 = Sunday, 6 = Saturday
+ opens_at TIME NOT NULL,
+ closes_at TIME NOT NULL,
+ is_24_7 BOOLEAN DEFAULT FALSE,
+ created_at timestamp with time zone DEFAULT now(),
+ updated_at timestamp with time zone DEFAULT now()
+);
+
-- Triggers
CREATE TRIGGER study_spaces_updated_at
AFTER UPDATE ON study_spaces
@@ -51,3 +63,7 @@ FOR EACH ROW EXECUTE FUNCTION handle_updated_at();
CREATE TRIGGER reports_updated_at
AFTER UPDATE ON reports
FOR EACH ROW EXECUTE FUNCTION handle_updated_at();
+
+CREATE TRIGGER study_space_hours_updated_at
+AFTER UPDATE ON study_space_hours
+FOR EACH ROW EXECUTE FUNCTION handle_updated_at();