class TenantSingleSerializer(ZopsBaseSerializer): organizationName = StringField("organization name", source='organization_name') address = StringField("physical address") phone = StringField("phone number, length must be 11 character.", validators=[phone_validator]) email = StringField("email for tenant")
class LoginSerializer(ZopsBaseSerializer): token = StringField("Access token.", read_only=True) email = StringField("Email for user.Max length 70 Character", write_only=True, validators=[email_validator]) password = StringField("Password for user.Max length 128 Character", write_only=True)
class SubscriptionSerializer(BaseSerializer): # todo add validators to the fields. email = StringField("Email to send repository reports", allow_null=False) subscriptions = ListOfStringsField("List of subscribed github ids", allow_null=False) period = StringField("Notification period e.g. daily, or weekly", allow_null=False)
class SubscriptionSerializer(BaseSerializer): #TODO: ADD VALIDATORS email = StringField("Email to send repository reports") subscriptions = JsonField("List of subscribed github ids") period = StringField("Notification period e.g. daily, or weekly") telegramID = StringField("Telegram ID") repoCount = IntField("Number of suggestions each time")
class ProjectResourceSerializer(ZopsBaseSerializer): name = StringField("Project name.Max length 70 Character") description = StringField("Project description.Max length 200 Character") id = StringField("ID", read_only=True) userLimit = IntField("User limit of service.", read_only=True, source='user_limit') userUsed = IntField("User used of service.", read_only=True, source='user_used') services = ZopsListOfStringsField("Project's active services", read_only=True)
class RegisterSerializer(ZopsBaseSerializer): organizationName = StringField( "Organization name.Max length 100 Character", source='organization_name') email = StringField("Email for account.Max length 70 Character") registrationId = StringField("Registered account id.", read_only=True, source='id')
def test_string_field(): field = StringField("test str field") assert field.to_representation("foo") == "foo" assert field.to_representation(123) == "123" assert field.from_representation("foo") == "foo" assert field.from_representation(123) == "123"
class AccountSerializer(ZopsBaseSerializer): organizationName = StringField( "Organization Name.Max Organization Name length 100 Character", source='organization_name') address = StringField("Address. Max Address length 200 Character") phone = StringField("Phone Number, length must be 11 character.", validators=[phone_validator]) email = StringField("Email for Account.Max Email length 70 Character")
class TestSerializer(BaseSerializer): one = StringField("one different than two") two = StringField("two different than one") def validate(self, object_dict, partial=False): super().validate(object_dict, partial) # possible use case: kind of uniqueness relationship if object_dict['one'] == object_dict['two']: raise ValidationError("one must be different than two")
class UserSerializer(ZopsBaseSerializer): id = StringField("ID", read_only=True) email = StringField("Email for user.Max length 70 Character", read_only=True) role = StringField("Role of user.", read_only=True) firstName = StringField("Name of user.Max length 32 Character", source='first_name', read_only=True) lastName = StringField("Last Name of user.Max length 32 Character", source='last_name', read_only=True)
class ServiceSerializer(ZopsBaseSerializer): id = StringField("ID", read_only=True) itemLimit = IntField("Item limit of service.", read_only=True, source='item_limit') itemUsed = IntField("Item used of service.", read_only=True, source='item_used') name = StringField("Service name.Max length 70 Character") description = StringField("Service description.Max length 200 Character") serviceCatalogCode = StringField("Code name of the service.", validators=[is_service_code], source="service_catalog_code")
class ExampleSerializer(BaseSerializer): up = StringField( details='multiple values field', many=True, validators=[is_upper], allow_null=True, )
class TenantSerializer(ZopsBaseSerializer): email = StringField("email for user", validators=[email_validator]) password = StringField("password for user") organizationName = StringField("organization name", source='organization_name') address = StringField("physical address") phone = StringField("phone number, length must be 11 character.", validators=[phone_validator]) tenantEmail = StringField("email for tenant", source='tenant_email') tenantId = StringField("ID for tenant", read_only=True, source='tenant_id') managerToken = StringField("auth token of tenant manager", read_only=True, source='manager_token')
class EmailSerializer(ZopsBaseSerializer): accountId = StringField("Account id", read_only=True, source="account_id") providerMailId = StringField("Provider mail id", read_only=True, source="provider_mail_id") receiver = StringField("Email address.", read_only=True) subject = StringField("Email subject", read_only=True) text = StringField("Email text", read_only=True) provider = StringField("Email provider", read_only=True) category = StringField("Email category", read_only=True)
class UserSerializer(ZopsBaseSerializer): id = StringField("ID", read_only=True) token = StringField("Access token", read_only=True) email = StringField("Email for user.Max length 70 Character", validators=[email_validator]) password = StringField("Password for user.Max length 128 Character", write_only=True) role = StringField("Role of user.", read_only=True) firstName = StringField("Name of user.Max length 32 Character", source='first_name') lastName = StringField("Last Name of user.Max length 32 Character", source='last_name')
class RegisterSingleSerializer(ZopsBaseSerializer): id = StringField("ID", read_only=True) email = StringField("Email for user.Max length 70 Character", validators=[email_validator]) password = StringField("Password for user.Max length 128 Character", write_only=True) approveCode = StringField("Approve code to activate the account.", write_only=True, source='approve_code') firstName = StringField("Name of user.Max length 32 Character", source='first_name') lastName = StringField("Last Name of user.Max length 32 Character", source='last_name') token = StringField("User token", read_only=True)
class LogTrackingSerializer(ZopsBaseSerializer): id = StringField("ID", read_only=True) description = StringField("Log Message", read_only=True) levelName = StringField("Log Level Name", read_only=True, source="level_name") functionName = StringField("Log Function Name", read_only=True, source="function_name") pathName = StringField("Log path name", read_only=True, source="path_name") lineNumber = StringField("Log line number", read_only=True, source="line_number") creationTime = ZopsDatetimeField("Log Creation Time", read_only=True, source="creation_time")
class ProjectServicesAdminTokenSerializer(ZopsBaseSerializer): projectServicesAdminToken = StringField("Project Services Admin Token", source='project_services_admin_token', read_only=True)
class ConsumerSerializer(ZopsBaseSerializer): id = StringField("ID of consumer.", read_only=True)
class ResetPasswordSerializer(ZopsBaseSerializer): resetToken = StringField("Forgot Password Token", write_only=True, source="reset_token") password = StringField("New password for user. Max length 128 Character", write_only=True)
class ForgotPasswordSerializer(ZopsBaseSerializer): email = StringField("Email for user.Max length 70 Character", write_only=True, validators=[email_validator])
class LogoutSerializer(ZopsBaseSerializer): token = StringField("Access token", read_only=True)
class ServiceCatalogSerializer(ZopsBaseSerializer): name = StringField("Service Catalog name") description = StringField("Service Catalog description") codeName = StringField("Code name of the service.", source='code_name')
class ConsumerTokenSerializer(ZopsBaseSerializer): consumerId = StringField("Consumer ID", source='consumer_id') projectId = StringField("Project ID", source='project_id') serviceCatalogCode = StringField("Service Code", source='service_catalog_code') token = StringField("Refresh Token", read_only=True)
class ApproveCodeSerializer(ZopsBaseSerializer): email = StringField("Email for account.Max length 70 Character", write_only=True)
class ProjectSecretSerializer(ZopsBaseSerializer): fcmApiKeys = StringField("Fcm API Key", source='fcm_api_key') fcmProjectNumber = StringField("Fcm Project Number", source='fcm_project_number') apnsCert = StringField("Apns Cert", source='apns_cert') id = StringField("ID", read_only=True)
class CatSerializer(BaseSerializer): id = IntField("cat identification number", read_only=True) name = StringField("cat name", validators=[is_lower_case]) breed = StringField("official breed name")
class ProjectConsumerSerializer(ZopsBaseSerializer): consumerId = StringField("List of consumer_id's", source='consumer_id')