fix
This commit is contained in:
parent
8c620abbe6
commit
a7e85e0f0d
2 changed files with 7 additions and 3 deletions
|
|
@ -12,6 +12,7 @@ public class EventContent
|
||||||
public string RulesAndGdpr { get; set; } = string.Empty;
|
public string RulesAndGdpr { get; set; } = string.Empty;
|
||||||
public string AdditionalInfo { get; set; } = string.Empty;
|
public string AdditionalInfo { get; set; } = string.Empty;
|
||||||
public bool RegistrationEnabled { get; set; } = true;
|
public bool RegistrationEnabled { get; set; } = true;
|
||||||
|
public bool VolunteerRegistrationEnabled { get; set; } = true;
|
||||||
public bool VisitorOnly { get; set; } = false;
|
public bool VisitorOnly { get; set; } = false;
|
||||||
public string VolunteerAreas { get; set; } = string.Empty;
|
public string VolunteerAreas { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,18 +57,20 @@ public class RegistrationRepository(IConfiguration configuration) : IRegistratio
|
||||||
rules_and_gdpr TEXT,
|
rules_and_gdpr TEXT,
|
||||||
additional_info TEXT,
|
additional_info TEXT,
|
||||||
registration_enabled BOOLEAN DEFAULT TRUE,
|
registration_enabled BOOLEAN DEFAULT TRUE,
|
||||||
|
volunteer_registration_enabled BOOLEAN DEFAULT TRUE,
|
||||||
visitor_only BOOLEAN DEFAULT FALSE,
|
visitor_only BOOLEAN DEFAULT FALSE,
|
||||||
volunteer_areas TEXT DEFAULT ''
|
volunteer_areas TEXT DEFAULT ''
|
||||||
);
|
);
|
||||||
ALTER TABLE event_content ADD COLUMN IF NOT EXISTS additional_info TEXT;
|
ALTER TABLE event_content ADD COLUMN IF NOT EXISTS additional_info TEXT;
|
||||||
ALTER TABLE event_content ADD COLUMN IF NOT EXISTS registration_enabled BOOLEAN DEFAULT TRUE;
|
ALTER TABLE event_content ADD COLUMN IF NOT EXISTS registration_enabled BOOLEAN DEFAULT TRUE;
|
||||||
|
ALTER TABLE event_content ADD COLUMN IF NOT EXISTS volunteer_registration_enabled BOOLEAN DEFAULT TRUE;
|
||||||
ALTER TABLE event_content ADD COLUMN IF NOT EXISTS visitor_only BOOLEAN DEFAULT FALSE;
|
ALTER TABLE event_content ADD COLUMN IF NOT EXISTS visitor_only BOOLEAN DEFAULT FALSE;
|
||||||
ALTER TABLE event_content ADD COLUMN IF NOT EXISTS volunteer_areas TEXT DEFAULT '';
|
ALTER TABLE event_content ADD COLUMN IF NOT EXISTS volunteer_areas TEXT DEFAULT '';
|
||||||
|
|
||||||
UPDATE event_content SET volunteer_areas = 'Kiosk & Kök' || chr(10) || 'Städning' || chr(10) || 'Entré & Incheckning' || chr(10) || 'Teknisk Support' || chr(10) || 'All-round' WHERE id = 1 AND (volunteer_areas IS NULL OR volunteer_areas = '');
|
UPDATE event_content SET volunteer_areas = 'Kiosk & Kök' || chr(10) || 'Städning' || chr(10) || 'Entré & Incheckning' || chr(10) || 'Teknisk Support' || chr(10) || 'All-round' WHERE id = 1 AND (volunteer_areas IS NULL OR volunteer_areas = '');
|
||||||
|
|
||||||
INSERT INTO event_content (id, title, sub_title, event_date, event_time, location_name, location_address, what_to_bring, rules_and_gdpr, additional_info, registration_enabled, visitor_only, volunteer_areas)
|
INSERT INTO event_content (id, title, sub_title, event_date, event_time, location_name, location_address, what_to_bring, rules_and_gdpr, additional_info, registration_enabled, volunteer_registration_enabled, visitor_only, volunteer_areas)
|
||||||
SELECT 1, '', '', '', '', '', '', '', '', '', TRUE, FALSE, 'Kiosk & Kök' || chr(10) || 'Städning' || chr(10) || 'Entré & Incheckning' || chr(10) || 'Teknisk Support' || chr(10) || 'All-round'
|
SELECT 1, '', '', '', '', '', '', '', '', '', TRUE, TRUE, FALSE, 'Kiosk & Kök' || chr(10) || 'Städning' || chr(10) || 'Entré & Incheckning' || chr(10) || 'Teknisk Support' || chr(10) || 'All-round'
|
||||||
WHERE NOT EXISTS (SELECT 1 FROM event_content WHERE id = 1);
|
WHERE NOT EXISTS (SELECT 1 FROM event_content WHERE id = 1);
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
@ -108,7 +110,7 @@ public class RegistrationRepository(IConfiguration configuration) : IRegistratio
|
||||||
public async Task<EventContent> GetEventContent()
|
public async Task<EventContent> GetEventContent()
|
||||||
{
|
{
|
||||||
using var connection = CreateConnection();
|
using var connection = CreateConnection();
|
||||||
var content = await connection.QueryFirstOrDefaultAsync<EventContent>("SELECT title, sub_title as SubTitle, event_date as EventDate, event_time as EventTime, location_name as LocationName, location_address as LocationAddress, what_to_bring as WhatToBring, rules_and_gdpr as RulesAndGdpr, additional_info as AdditionalInfo, registration_enabled as RegistrationEnabled, visitor_only as VisitorOnly, volunteer_areas as VolunteerAreas FROM event_content WHERE id = 1");
|
var content = await connection.QueryFirstOrDefaultAsync<EventContent>("SELECT title, sub_title as SubTitle, event_date as EventDate, event_time as EventTime, location_name as LocationName, location_address as LocationAddress, what_to_bring as WhatToBring, rules_and_gdpr as RulesAndGdpr, additional_info as AdditionalInfo, registration_enabled as RegistrationEnabled, volunteer_registration_enabled as VolunteerRegistrationEnabled, visitor_only as VisitorOnly, volunteer_areas as VolunteerAreas FROM event_content WHERE id = 1");
|
||||||
return content ?? new EventContent();
|
return content ?? new EventContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,6 +129,7 @@ public class RegistrationRepository(IConfiguration configuration) : IRegistratio
|
||||||
rules_and_gdpr = @RulesAndGdpr,
|
rules_and_gdpr = @RulesAndGdpr,
|
||||||
additional_info = @AdditionalInfo,
|
additional_info = @AdditionalInfo,
|
||||||
registration_enabled = @RegistrationEnabled,
|
registration_enabled = @RegistrationEnabled,
|
||||||
|
volunteer_registration_enabled = @VolunteerRegistrationEnabled,
|
||||||
visitor_only = @VisitorOnly,
|
visitor_only = @VisitorOnly,
|
||||||
volunteer_areas = @VolunteerAreas
|
volunteer_areas = @VolunteerAreas
|
||||||
WHERE id = 1";
|
WHERE id = 1";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue