Skip to content

Commit 65fbb9a

Browse files
Merge pull request #67 from StreetSupport/staging
Merge staging into main
2 parents 9e10ae1 + 785cdd6 commit 65fbb9a

File tree

9 files changed

+4
-2439
lines changed

9 files changed

+4
-2439
lines changed

src/controllers/bannerController.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ export const updateBanner = asyncHandler(async (req: Request, res: Response) =>
199199
// Preserve existing activation date fields and IsActive (not editable in edit form)
200200
finalBannerData.StartDate = banner.StartDate;
201201
finalBannerData.EndDate = banner.EndDate;
202-
finalBannerData.ShowDates = banner.ShowDates;
203202
finalBannerData.IsActive = banner.IsActive;
204203

205204
// Update banner
@@ -289,12 +288,10 @@ export const toggleBannerStatus = asyncHandler(async (req: Request, res: Respons
289288
// Handle date range for scheduled activation
290289
if (StartDate !== undefined && StartDate !== null) {
291290
updateData.StartDate = new Date(StartDate);
292-
updateData.ShowDates = true;
293291
} else if (updateData.IsActive && !StartDate) {
294292
// If activating immediately without dates, set StartDate to now
295293
updateData.StartDate = new Date();
296294
updateData.EndDate = null;
297-
updateData.ShowDates = false;
298295
}
299296

300297
if (EndDate !== undefined && EndDate !== null) {
@@ -303,7 +300,6 @@ export const toggleBannerStatus = asyncHandler(async (req: Request, res: Respons
303300
// If deactivating without explicit date, set EndDate to now
304301
updateData.StartDate = null;
305302
updateData.EndDate = new Date();
306-
updateData.ShowDates = false;
307303
}
308304

309305
// Update banner

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ dotenv.config();
1010
connectDB();
1111

1212
// Start background jobs
13-
startVerificationJob();
13+
// Only run verification job on staging environment
14+
if (process.env.NODE_ENV === 'staging' || process.env.ENVIRONMENT === 'staging') {
15+
startVerificationJob();
16+
}
1417
startDisablingJob();
1518
startSwepActivationJob();
1619
startBannerActivationJob();

src/models/bannerModel.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export const BannerSchema = new Schema({
8080
LayoutStyle: { type: String, enum: Object.values(LayoutStyle), required: true },
8181

8282
// Optional features
83-
ShowDates: { type: Boolean, default: false },
8483
StartDate: { type: Date },
8584
EndDate: { type: Date },
8685
BadgeText: { type: String, maxlength: 50 },

src/schemas/bannerSchema.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,12 @@ const BannerApiBaseSchema = BannerSchemaCore.omit({
5555
PartnershipCharter: true,
5656
ResourceProject: true,
5757
// Primitives that need preprocessing
58-
ShowDates: true,
5958
IsActive: true,
6059
Priority: true,
6160
StartDate: true,
6261
EndDate: true
6362
}).extend({
6463
// Add back omitted fields with JSON preprocessing for FormData
65-
ShowDates: z.preprocess(preprocessBoolean, z.boolean()).optional(),
6664
IsActive: z.preprocess(preprocessBoolean, z.boolean()).default(true),
6765
Priority: z.preprocess(preprocessNumber, z.number().min(1).max(10)).default(1),
6866
StartDate: z.preprocess(preprocessDate, z.date()).optional(),
@@ -94,7 +92,6 @@ export const BannerPreUploadApiSchema = z.object({
9492
TemplateType: z.nativeEnum(BannerTemplateType),
9593

9694
// Scheduling
97-
ShowDates: z.preprocess(preprocessBoolean, z.boolean()).optional(),
9895
StartDate: z.preprocess(preprocessDate, z.date()).optional(),
9996
EndDate: z.preprocess(preprocessDate, z.date()).optional(),
10097
BadgeText: z.string().max(25, 'Badge text must be 25 characters or less').optional(),

src/schemas/bannerSchemaCore.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ export const BannerSchemaCore = z.object({
120120
LayoutStyle: z.nativeEnum(LayoutStyle),
121121

122122
// Scheduling
123-
ShowDates: z.boolean().optional(),
124123
StartDate: z.date().optional(),
125124
EndDate: z.date().optional(),
126125
BadgeText: z.string().max(25, 'Badge text must be 25 characters or less').optional(),

0 commit comments

Comments
 (0)