|  | @@ -9,44 +9,84 @@ from tracim.models.data import UserRoleInWorkspace
 | 
	
		
			
			| 9 | 9 |  
 | 
	
		
			
			| 10 | 10 |  
 | 
	
		
			
			| 11 | 11 |  class ProfileSchema(marshmallow.Schema):
 | 
	
		
			
			| 12 |  | -    id = marshmallow.fields.Int(dump_only=True, validate=OneOf(Profile._IDS))
 | 
	
		
			
			| 13 |  | -    slug = marshmallow.fields.String(attribute='name', validate=OneOf(Profile._NAME))
 | 
	
		
			
			|  | 12 | +    slug = marshmallow.fields.String(
 | 
	
		
			
			|  | 13 | +        attribute='name',
 | 
	
		
			
			|  | 14 | +        validate=OneOf(Profile._NAME),
 | 
	
		
			
			|  | 15 | +        example='managers',
 | 
	
		
			
			|  | 16 | +    )
 | 
	
		
			
			|  | 17 | +
 | 
	
		
			
			|  | 18 | +    class Meta:
 | 
	
		
			
			|  | 19 | +        description = 'User Profile, give user right on whole Tracim instance.'
 | 
	
		
			
			| 14 | 20 |  
 | 
	
		
			
			| 15 | 21 |  
 | 
	
		
			
			| 16 | 22 |  class UserSchema(marshmallow.Schema):
 | 
	
		
			
			| 17 | 23 |  
 | 
	
		
			
			| 18 |  | -    user_id = marshmallow.fields.Int(dump_only=True)
 | 
	
		
			
			| 19 |  | -    email = marshmallow.fields.Email(required=True)
 | 
	
		
			
			| 20 |  | -    display_name = marshmallow.fields.String()
 | 
	
		
			
			| 21 |  | -    created = marshmallow.fields.DateTime(format='iso8601')
 | 
	
		
			
			| 22 |  | -    is_active = marshmallow.fields.Bool()
 | 
	
		
			
			|  | 24 | +    user_id = marshmallow.fields.Int(dump_only=True, example=3)
 | 
	
		
			
			|  | 25 | +    email = marshmallow.fields.Email(
 | 
	
		
			
			|  | 26 | +        required=True,
 | 
	
		
			
			|  | 27 | +        example='suri.cate@algoo.fr'
 | 
	
		
			
			|  | 28 | +    )
 | 
	
		
			
			|  | 29 | +    display_name = marshmallow.fields.String(
 | 
	
		
			
			|  | 30 | +        example='Suri Cate',
 | 
	
		
			
			|  | 31 | +    )
 | 
	
		
			
			|  | 32 | +    created = marshmallow.fields.DateTime(
 | 
	
		
			
			|  | 33 | +        format='iso8601',
 | 
	
		
			
			|  | 34 | +        description='User account creation date (iso8601 format).',
 | 
	
		
			
			|  | 35 | +    )
 | 
	
		
			
			|  | 36 | +    is_active = marshmallow.fields.Bool(
 | 
	
		
			
			|  | 37 | +        example=True,
 | 
	
		
			
			|  | 38 | +         # TODO - G.M - Explains this value.
 | 
	
		
			
			|  | 39 | +    )
 | 
	
		
			
			| 23 | 40 |      # TODO - G.M - 17-04-2018 - Restrict timezone values
 | 
	
		
			
			| 24 |  | -    timezone = marshmallow.fields.String()
 | 
	
		
			
			|  | 41 | +    timezone = marshmallow.fields.String(
 | 
	
		
			
			|  | 42 | +        example="Paris/Europe",
 | 
	
		
			
			|  | 43 | +    )
 | 
	
		
			
			| 25 | 44 |      # TODO - G.M - 17-04-2018 - check this, relative url allowed ?
 | 
	
		
			
			| 26 | 45 |      caldav_url = marshmallow.fields.Url(
 | 
	
		
			
			| 27 | 46 |          allow_none=True,
 | 
	
		
			
			| 28 | 47 |          relative=True,
 | 
	
		
			
			| 29 |  | -        attribute='calendar_url'
 | 
	
		
			
			|  | 48 | +        attribute='calendar_url',
 | 
	
		
			
			|  | 49 | +        example="/api/v2/calendar/user/3.ics/",
 | 
	
		
			
			|  | 50 | +        description="The url for calendar CalDAV direct access",
 | 
	
		
			
			|  | 51 | +    )
 | 
	
		
			
			|  | 52 | +    avatar_url = marshmallow.fields.Url(
 | 
	
		
			
			|  | 53 | +        allow_none=True,
 | 
	
		
			
			|  | 54 | +        example="/api/v2/assets/avatars/suri-cate.jpg",
 | 
	
		
			
			|  | 55 | +        description="avatar_url is the url to the image file. "
 | 
	
		
			
			|  | 56 | +                    "If no avatar, then set it to null "
 | 
	
		
			
			|  | 57 | +                    "(and frontend will interpret this with a default avatar)",
 | 
	
		
			
			| 30 | 58 |      )
 | 
	
		
			
			| 31 |  | -    avatar_url = marshmallow.fields.Url(allow_none=True)
 | 
	
		
			
			| 32 | 59 |      profile = marshmallow.fields.Nested(
 | 
	
		
			
			| 33 | 60 |          ProfileSchema,
 | 
	
		
			
			| 34 | 61 |          many=False,
 | 
	
		
			
			| 35 | 62 |      )
 | 
	
		
			
			| 36 | 63 |  
 | 
	
		
			
			|  | 64 | +    class Meta:
 | 
	
		
			
			|  | 65 | +        description = 'User account of Tracim'
 | 
	
		
			
			|  | 66 | +
 | 
	
		
			
			| 37 | 67 |  
 | 
	
		
			
			| 38 | 68 |  class UserIdPathSchema(marshmallow.Schema):
 | 
	
		
			
			| 39 |  | -    user_id = marshmallow.fields.Int()
 | 
	
		
			
			|  | 69 | +    user_id = marshmallow.fields.Int(example=3)
 | 
	
		
			
			| 40 | 70 |  
 | 
	
		
			
			| 41 | 71 |  
 | 
	
		
			
			| 42 | 72 |  class WorkspaceIdPathSchema(marshmallow.Schema):
 | 
	
		
			
			| 43 |  | -    workspace_id = marshmallow.fields.Int()
 | 
	
		
			
			|  | 73 | +    workspace_id = marshmallow.fields.Int(example=4)
 | 
	
		
			
			| 44 | 74 |  
 | 
	
		
			
			| 45 | 75 |  
 | 
	
		
			
			| 46 | 76 |  class BasicAuthSchema(marshmallow.Schema):
 | 
	
		
			
			| 47 | 77 |  
 | 
	
		
			
			| 48 |  | -    email = marshmallow.fields.Email(required=True)
 | 
	
		
			
			| 49 |  | -    password = marshmallow.fields.String(required=True, load_only=True)
 | 
	
		
			
			|  | 78 | +    email = marshmallow.fields.Email(
 | 
	
		
			
			|  | 79 | +        example='suri.cate@algoo.fr',
 | 
	
		
			
			|  | 80 | +        required=True
 | 
	
		
			
			|  | 81 | +    )
 | 
	
		
			
			|  | 82 | +    password = marshmallow.fields.String(
 | 
	
		
			
			|  | 83 | +        example='8QLa$<w',
 | 
	
		
			
			|  | 84 | +        required=True,
 | 
	
		
			
			|  | 85 | +        load_only=True,
 | 
	
		
			
			|  | 86 | +    )
 | 
	
		
			
			|  | 87 | +
 | 
	
		
			
			|  | 88 | +    class Meta:
 | 
	
		
			
			|  | 89 | +        description = 'Entry for HTTP Basic Auth'
 | 
	
		
			
			| 50 | 90 |  
 | 
	
		
			
			| 51 | 91 |      @post_load
 | 
	
		
			
			| 52 | 92 |      def make_login(self, data):
 | 
	
	
		
			
			|  | @@ -58,46 +98,75 @@ class LoginOutputHeaders(marshmallow.Schema):
 | 
	
		
			
			| 58 | 98 |  
 | 
	
		
			
			| 59 | 99 |  
 | 
	
		
			
			| 60 | 100 |  class NoContentSchema(marshmallow.Schema):
 | 
	
		
			
			|  | 101 | +
 | 
	
		
			
			|  | 102 | +    class Meta:
 | 
	
		
			
			|  | 103 | +        description = 'Empty Schema'
 | 
	
		
			
			| 61 | 104 |      pass
 | 
	
		
			
			| 62 | 105 |  
 | 
	
		
			
			| 63 | 106 |  
 | 
	
		
			
			| 64 | 107 |  class WorkspaceMenuEntrySchema(marshmallow.Schema):
 | 
	
		
			
			| 65 |  | -    slug = marshmallow.fields.String()
 | 
	
		
			
			| 66 |  | -    label = marshmallow.fields.String()
 | 
	
		
			
			| 67 |  | -    route = marshmallow.fields.String()
 | 
	
		
			
			| 68 |  | -    hexcolor = marshmallow.fields.String()
 | 
	
		
			
			| 69 |  | -    icon = marshmallow.fields.String()
 | 
	
		
			
			|  | 108 | +    slug = marshmallow.fields.String(example='markdown-pages')
 | 
	
		
			
			|  | 109 | +    label = marshmallow.fields.String(example='Markdown Documents')
 | 
	
		
			
			|  | 110 | +    route = marshmallow.fields.String(
 | 
	
		
			
			|  | 111 | +        example='/#/workspace/{workspace_id}/contents/?type=mardown-page',
 | 
	
		
			
			|  | 112 | +        description='the route is the frontend route. '
 | 
	
		
			
			|  | 113 | +                    'It may include workspace_id '
 | 
	
		
			
			|  | 114 | +                    'which must be replaced on backend size '
 | 
	
		
			
			|  | 115 | +                    '(the route must be ready-to-use)'
 | 
	
		
			
			|  | 116 | +    )
 | 
	
		
			
			|  | 117 | +    icon = marshmallow.fields.String(
 | 
	
		
			
			|  | 118 | +        example='file-text-o',
 | 
	
		
			
			|  | 119 | +        description='CSS class of the icon. Example: file-o for using Fontawesome file-text-o icon',  # nopep8
 | 
	
		
			
			|  | 120 | +    )
 | 
	
		
			
			|  | 121 | +    hexcolor = marshmallow.fields.String(
 | 
	
		
			
			|  | 122 | +        example='#F0F9DC',
 | 
	
		
			
			|  | 123 | +        description='Hexadecimal color of the entry.'
 | 
	
		
			
			|  | 124 | +    )
 | 
	
		
			
			|  | 125 | +
 | 
	
		
			
			|  | 126 | +    class Meta:
 | 
	
		
			
			|  | 127 | +        description = 'Entry element of a workspace menu'
 | 
	
		
			
			| 70 | 128 |  
 | 
	
		
			
			| 71 | 129 |  
 | 
	
		
			
			| 72 | 130 |  class WorkspaceSchema(marshmallow.Schema):
 | 
	
		
			
			| 73 |  | -    id = marshmallow.fields.Int()
 | 
	
		
			
			| 74 |  | -    slug = marshmallow.fields.String()
 | 
	
		
			
			| 75 |  | -    label = marshmallow.fields.String()
 | 
	
		
			
			| 76 |  | -    description = marshmallow.fields.String()
 | 
	
		
			
			|  | 131 | +    id = marshmallow.fields.Int(example=4)
 | 
	
		
			
			|  | 132 | +    slug = marshmallow.fields.String(example='intranet')
 | 
	
		
			
			|  | 133 | +    label = marshmallow.fields.String(example='Intranet')
 | 
	
		
			
			|  | 134 | +    description = marshmallow.fields.String(example='All intranet data.')
 | 
	
		
			
			| 77 | 135 |      sidebar_entries = marshmallow.fields.Nested(
 | 
	
		
			
			| 78 | 136 |          WorkspaceMenuEntrySchema,
 | 
	
		
			
			| 79 | 137 |          many=True,
 | 
	
		
			
			| 80 | 138 |      )
 | 
	
		
			
			| 81 | 139 |  
 | 
	
		
			
			|  | 140 | +    class Meta:
 | 
	
		
			
			|  | 141 | +        description = 'Full workspace informations'
 | 
	
		
			
			|  | 142 | +
 | 
	
		
			
			| 82 | 143 |  
 | 
	
		
			
			| 83 | 144 |  class WorkspaceDigestSchema(marshmallow.Schema):
 | 
	
		
			
			| 84 |  | -    id = marshmallow.fields.Int()
 | 
	
		
			
			| 85 |  | -    label = marshmallow.fields.String()
 | 
	
		
			
			|  | 145 | +    id = marshmallow.fields.Int(example=4)
 | 
	
		
			
			|  | 146 | +    label = marshmallow.fields.String(example='Intranet')
 | 
	
		
			
			| 86 | 147 |      sidebar_entries = marshmallow.fields.Nested(
 | 
	
		
			
			| 87 | 148 |          WorkspaceMenuEntrySchema,
 | 
	
		
			
			| 88 | 149 |          many=True,
 | 
	
		
			
			| 89 | 150 |      )
 | 
	
		
			
			| 90 | 151 |  
 | 
	
		
			
			|  | 152 | +    class Meta:
 | 
	
		
			
			|  | 153 | +        description = 'Digest of workspace informations'
 | 
	
		
			
			|  | 154 | +
 | 
	
		
			
			| 91 | 155 |  
 | 
	
		
			
			| 92 | 156 |  class WorkspaceMemberSchema(marshmallow.Schema):
 | 
	
		
			
			| 93 |  | -    role_id = marshmallow.fields.Int(validate=OneOf(UserRoleInWorkspace.get_all_role_values()))  # nopep8
 | 
	
		
			
			| 94 |  | -    role_slug = marshmallow.fields.String(validate=OneOf(UserRoleInWorkspace.get_all_role_slug()))  # nopep8
 | 
	
		
			
			| 95 |  | -    user_id = marshmallow.fields.Int()
 | 
	
		
			
			| 96 |  | -    workspace_id = marshmallow.fields.Int()
 | 
	
		
			
			|  | 157 | +    role_slug = marshmallow.fields.String(
 | 
	
		
			
			|  | 158 | +        example='contributor',
 | 
	
		
			
			|  | 159 | +        validate=OneOf(UserRoleInWorkspace.get_all_role_slug())
 | 
	
		
			
			|  | 160 | +    )
 | 
	
		
			
			|  | 161 | +    user_id = marshmallow.fields.Int(example=3)
 | 
	
		
			
			|  | 162 | +    workspace_id = marshmallow.fields.Int(example=4)
 | 
	
		
			
			| 97 | 163 |      user = marshmallow.fields.Nested(
 | 
	
		
			
			| 98 | 164 |          UserSchema(only=('display_name', 'avatar_url'))
 | 
	
		
			
			| 99 | 165 |      )
 | 
	
		
			
			| 100 | 166 |  
 | 
	
		
			
			|  | 167 | +    class Meta:
 | 
	
		
			
			|  | 168 | +        description = 'Workspace Member information'
 | 
	
		
			
			|  | 169 | +
 | 
	
		
			
			| 101 | 170 |  
 | 
	
		
			
			| 102 | 171 |  class ApplicationConfigSchema(marshmallow.Schema):
 | 
	
		
			
			| 103 | 172 |      pass
 | 
	
	
		
			
			|  | @@ -105,11 +174,23 @@ class ApplicationConfigSchema(marshmallow.Schema):
 | 
	
		
			
			| 105 | 174 |  
 | 
	
		
			
			| 106 | 175 |  
 | 
	
		
			
			| 107 | 176 |  class ApplicationSchema(marshmallow.Schema):
 | 
	
		
			
			| 108 |  | -    label = marshmallow.fields.String()
 | 
	
		
			
			| 109 |  | -    slug = marshmallow.fields.String()
 | 
	
		
			
			| 110 |  | -    icon = marshmallow.fields.String()
 | 
	
		
			
			| 111 |  | -    hexcolor = marshmallow.fields.String()
 | 
	
		
			
			| 112 |  | -    is_active = marshmallow.fields.Boolean()
 | 
	
		
			
			|  | 177 | +    label = marshmallow.fields.String(example='Calendar')
 | 
	
		
			
			|  | 178 | +    slug = marshmallow.fields.String(example='calendar')
 | 
	
		
			
			|  | 179 | +    icon = marshmallow.fields.String(
 | 
	
		
			
			|  | 180 | +        example='file-o',
 | 
	
		
			
			|  | 181 | +        description='CSS class of the icon. Example: file-o for using Fontawesome file-o icon',  # nopep8
 | 
	
		
			
			|  | 182 | +    )
 | 
	
		
			
			|  | 183 | +    hexcolor = marshmallow.fields.String(
 | 
	
		
			
			|  | 184 | +        example='#FF0000',
 | 
	
		
			
			|  | 185 | +        description='HTML encoded color associated to the application. Example:#FF0000 for red'  # nopep8
 | 
	
		
			
			|  | 186 | +    )
 | 
	
		
			
			|  | 187 | +    is_active = marshmallow.fields.Boolean(
 | 
	
		
			
			|  | 188 | +        example=True,
 | 
	
		
			
			|  | 189 | +        description='if true, the application is in use in the context',
 | 
	
		
			
			|  | 190 | +    )
 | 
	
		
			
			| 113 | 191 |      config = marshmallow.fields.Nested(
 | 
	
		
			
			| 114 | 192 |          ApplicationConfigSchema,
 | 
	
		
			
			| 115 | 193 |      )
 | 
	
		
			
			|  | 194 | +
 | 
	
		
			
			|  | 195 | +    class Meta:
 | 
	
		
			
			|  | 196 | +        description = 'Tracim Application informations'
 |