Skip to content

feat: add event privacy settings validation (step two)#70

Merged
DioChuks merged 2 commits intoBuidlZone-Labs:mainfrom
Cedarich:feature/event-privacy-settings-step-two
Mar 9, 2026
Merged

feat: add event privacy settings validation (step two)#70
DioChuks merged 2 commits intoBuidlZone-Labs:mainfrom
Cedarich:feature/event-privacy-settings-step-two

Conversation

@Cedarich
Copy link

@Cedarich Cedarich commented Mar 9, 2026

Overview

Implements Step 2 of the event creation request validation, focusing on comprehensive privacy settings and advanced event configuration.

Changes

Model Updates

  • ✅ Added privacyLevel enum (0=anonymous, 1=wallet-required, 2=verified-access)
  • ✅ Added attendanceMode (auto-derived from privacy level)
  • ✅ Added eventType enum (0=FREE, 1=PAID) with business rule enforcement
  • ✅ Added locationType enum (0=exact, 1=general)
  • ✅ Added paymentPrivacy enum (0=anonymous, 1=public)
  • ✅ Added preference flags: offerReceipts, hasZkEmailUpdates, hasEventReminders
  • ✅ Restructured ticketType to array of objects with detailed pricing
  • ✅ Added isPublished boolean flag

Validation Layer

  • ✅ Created CreateEventStepTwoSchema with Zod
  • ✅ Business rule: PAID events require wallet-required privacy level
  • ✅ Business rule: Payment privacy required for paid events only
  • ✅ Comprehensive field validations with custom error messages

Service Layer

  • createEventWithPrivacySettings() - Creates events with full privacy config
  • updateEventPrivacySettings() - Updates with ownership verification
  • getEventById() - Retrieves complete event details
  • ✅ Auto-calculation of total/available tickets

API Endpoints

  • POST /api/event-tickets/create-step-two - Create event (auth required)
  • PATCH /api/event-tickets/:eventId/update-step-two - Update privacy settings (auth required)
  • GET /api/event-tickets/:eventId - Get event details (public)

Business Rules Enforced

  1. PAID events → Must have privacyLevel = 1 (wallet-required)
  2. Payment privacy → Required only for PAID events
  3. Attendance mode → Automatically derived from privacy level
  4. Ticket quantities → Auto-calculated from ticket type array

Testing Recommendations

  • Test creating FREE vs PAID events with different privacy levels
  • Verify PAID event creation fails without wallet-required privacy
  • Test updating privacy settings with valid authentication
  • Verify unauthorized users cannot update events
  • Test ticket type array validation
  • Verify auto-calculation of total tickets

Backward Compatibility

✅ All existing event endpoints remain functional
✅ No breaking changes to current API consumers

closes #46

@Cedarich
Copy link
Author

Cedarich commented Mar 9, 2026

@DioChuks please approve workflow

I had to do a fresh implementation

Thank you

@DioChuks DioChuks self-requested a review March 9, 2026 22:19
Copy link
Contributor

@DioChuks DioChuks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still sort of the same PR u raised like the former. I'll approve this & work on removing the overload.

@DioChuks DioChuks merged commit 09f7522 into BuidlZone-Labs:main Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement thebasic privacy request validation

3 participants