Finish validation for the POST request. New fields were added to deal with recurrence and startTime and endTime fields, along with a new method of dealing with phone numbers in the DB.
Additions made
Validation for startTime and endTime: made sure startTime is before endTime. This is the only validation done on these fields because the serializer handles determining whether the times are in the correct format.
Validation for phone: Make sure it is a string that only contains digits. This is so that unusual phone numbers, like 211 acn be considered valid.
Added default values for isRecurring and recurrenceDays. For isRecurring, this value is None. OTOH, if recurrenceDays is None, the serializer returns an error: This field may not be null. Therefore, the default value for recurrenceDays must be an empty list.
Purpose
Finish validation for the POST request. New fields were added to deal with recurrence and
startTime
andendTime
fields, along with a new method of dealing with phone numbers in the DB.Additions made
startTime
andendTime
: made surestartTime
is beforeendTime
. This is the only validation done on these fields because the serializer handles determining whether the times are in the correct format.phone
: Make sure it is a string that only contains digits. This is so that unusual phone numbers, like211
acn be considered valid.isRecurring
andrecurrenceDays
. ForisRecurring
, this value isNone
. OTOH, ifrecurrenceDays
isNone
, the serializer returns an error:This field may not be null
. Therefore, the default value forrecurrenceDays
must be an empty list.