Skip to content
Anton Abramov edited this page Feb 28, 2015 · 5 revisions
{
	"title": "Users",
	"description": "Пользователи",
	"type": "object",
	"properties": {
		"id": {
			"description": "id пользователя",
			"type": "number"
		},
		"name": {
			"description": "Имя пользователя",
			"type": "string"
		},
		"pass": {
			"description": "Пароль пользователя",
			"type": "string"
		},
		"email": {
			"description": "email пользователя",
			"type": "string"
		},
		"groups": {
			"description": "Группы",
			"type": "object",
			"properties": {
				"id": {
					"description": "id группы",
					"type": "number"
				},
				"status": {
					"description": "Статус участия в группе. 0-Приглашен, 1-Участник",
					"type": "number"
				}
			}	
		}
	}
},
{
	"title": "Groups",
	"description": "Группы",
	"type": "object",
	"properties": {
		"id": {
			"description": "id группы",
			"type": "number"
		},
		"title": {
			"description": "Имя группы",
			"type": "string"
		},
		"about": {
			"description": "Описание группы",
			"type": "string"
		},
		"budget": {
			"description": "Бюджет группы",
			"type": "number"
		},
		"photo": {
			"description": "Фото группы (url)",
			"type": "string"
		},
		"users": {
			"description": "Пользователи",
			"type": "object",
			"properties": {
				"id": {
					"description": "id пользователя",
					"type": "number"
				},
				"role": {
					"description": "Роль пользователя группы. 0-Обычный, 1-Администратор",
					"type": "number"
				}
			}	
		}
	}
},
{
	"title": "Posts",
	"description": "Посты",
	"type": "object",
	"properties": {
		"id": {
			"description": "id поста",
			"type": "number"
		},
		"uid": {
			"description": "id пользователя, сделавшего пост",
			"type": "number"
		},
		"gid": {
			"description": "id группы, в которой сделан пост",
			"type": "number"	
		},
		"created": {
			"description": "дата и время создания поста",
			"type": "datetime"	
		},
		"title": {
			"description": "Название поста",
			"type": "string"
		},
		"text": {
			"description": "Текст поста",
			"type": "string"
		},
		"sum": {
			"description": "Сумма покупки",
			"type": "number"
		},
		"photo": {
			"description": "Фото покупки/чека (url)",
			"type": "string"
		}
	}		
}

Дополнение: Первичная реализация структуры базы данных. В данной реализации каждый пользователь знает свои группы, а группа своих пользователей. Роль пользователя определена в таблице группы. На данном этапе всего две роли. Обычный пользователь и администратор.