1- import { ProposalInput , isWorkshopFormat } from './types'
1+ import { ProposalInput } from './types'
22
33export const PROPOSAL_VALIDATION_MESSAGES = {
44 TITLE_REQUIRED : 'Title is required' ,
@@ -9,20 +9,12 @@ export const PROPOSAL_VALIDATION_MESSAGES = {
99 TOPICS_REQUIRED : 'At least one topic is required' ,
1010 SPEAKERS_REQUIRED : 'At least one speaker is required' ,
1111 TOS_REQUIRED : 'You must accept the terms of service' ,
12- CAPACITY_REQUIRED : 'Workshop capacity is required for workshop formats' ,
1312} as const
1413
15- export interface ProposalValidationOptions {
16- requireSpeakers ?: boolean
17- requireCapacity ?: boolean
18- }
19-
2014export function validateProposalForm (
2115 proposal : ProposalInput ,
22- options : ProposalValidationOptions = { } ,
2316) : Record < string , string > {
2417 const errors : Record < string , string > = { }
25- const { requireCapacity = true } = options
2618
2719 if ( ! proposal . title || proposal . title . trim ( ) === '' ) {
2820 errors . title = PROPOSAL_VALIDATION_MESSAGES . TITLE_REQUIRED
@@ -52,23 +44,14 @@ export function validateProposalForm(
5244 errors . tos = PROPOSAL_VALIDATION_MESSAGES . TOS_REQUIRED
5345 }
5446
55- // Workshop-specific validation
56- if (
57- requireCapacity &&
58- isWorkshopFormat ( proposal . format ) &&
59- ! proposal . capacity
60- ) {
61- errors . capacity = PROPOSAL_VALIDATION_MESSAGES . CAPACITY_REQUIRED
62- }
63-
6447 return errors
6548}
6649
6750export function validateProposalForAdmin (
6851 proposal : ProposalInput ,
6952 speakerIds : string [ ] ,
7053) : Record < string , string > {
71- const errors = validateProposalForm ( proposal , { requireSpeakers : true } )
54+ const errors = validateProposalForm ( proposal )
7255
7356 if ( ! speakerIds || speakerIds . length === 0 ) {
7457 errors . speakers = PROPOSAL_VALIDATION_MESSAGES . SPEAKERS_REQUIRED
0 commit comments