feat(advertising): implement advertising service with CRUD operations and validation
- Added advertising.go for managing advertising entries with Create and List functionalities. - Implemented CreateAdvertisingParams with validation for name, email, and status. - Created migrations for advertising table structure. - Added tests for advertising parameters validation. feat(promo): introduce promo management with validation and CRUD operations - Added promo.go for managing promotional entries with Create, Update, and List functionalities. - Implemented CreatePromoParams and UpdatePromoParams with validation for position, section, and weeks. - Created migrations for promo table structure. - Added tests for promo parameters validation. feat(images): add image management service with upload and retrieval - Added images.go for managing image uploads and retrieval from storage. - Implemented SaveImageParams with validation for image description and data. - Created migrations for images table structure. - Added tests for image parameters validation and data parsing.
This commit is contained in:
7
advertising/migrations/1_create_advertising.up.sql
Normal file
7
advertising/migrations/1_create_advertising.up.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
CREATE TABLE advertising (
|
||||
id UUID PRIMARY KEY,
|
||||
nome TEXT NOT NULL,
|
||||
email TEXT NOT NULL,
|
||||
status TEXT NOT NULL CHECK (status IN ('active', 'inactive')),
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
7
advertising/migrations/2_create_promo.up.sql
Normal file
7
advertising/migrations/2_create_promo.up.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
CREATE TABLE promo (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
position INT NOT NULL CHECK (position IN (0, 1, 2)),
|
||||
item JSONB NOT NULL DEFAULT '[]'::jsonb,
|
||||
active_from TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
1
advertising/migrations/3_add_section_to_promo.up.sql
Normal file
1
advertising/migrations/3_add_section_to_promo.up.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE promo ADD COLUMN section VARCHAR(50) NOT NULL DEFAULT '';
|
||||
2
advertising/migrations/4_add_weeks_to_promo.up.sql
Normal file
2
advertising/migrations/4_add_weeks_to_promo.up.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE promo ADD COLUMN year INT NOT NULL DEFAULT EXTRACT(YEAR FROM NOW());
|
||||
ALTER TABLE promo ADD COLUMN weeks JSONB NOT NULL DEFAULT '[]'::jsonb;
|
||||
Reference in New Issue
Block a user