yao/xiang/models/user.json
2021-09-29 12:25:38 +08:00

345 lines
8.6 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"name": "用户",
"table": {
"name": "xiang_user",
"comment": "用户表",
"engine": "InnoDB"
},
"columns": [
{ "label": "ID", "name": "id", "type": "ID" },
{
"label": "类型",
"name": "type",
"type": "enum",
"option": ["admin", "staff", "user", "robot"],
"comment": "账号类型 admin 管理员, staff 员工, user 用户, robot 机器人",
"default": "user",
"index": true,
"validations": [
{
"method": "typeof",
"args": ["string"],
"message": "{{input}}类型错误, {{label}}应该为字符串"
},
{
"method": "enum",
"args": ["admin", "staff", "user", "robot"],
"message": "{{input}}不在许可范围, {{label}}应该为 admin/staff/user/robot"
}
]
},
{
"label": "邮箱",
"name": "email",
"type": "string",
"length": 50,
"comment": "邮箱",
"index": true,
"nullable": true,
"validations": [
{
"method": "typeof",
"args": ["string"],
"message": "{{input}}类型错误, {{label}}应该为字符串"
},
{
"method": "email",
"args": [],
"message": "{{input}}不是邮箱地址"
}
]
},
{
"label": "手机号",
"name": "mobile",
"type": "string",
"length": 50,
"comment": "手机号",
"index": true,
"nullable": true,
"crypt": "AES",
"validations": [
{
"method": "mobile",
"args": [],
"message": "{{input}}格式错误"
}
]
},
{
"label": "登录密码",
"name": "password",
"type": "string",
"length": 256,
"comment": "登录密码",
"crypt": "PASSWORD",
"index": true,
"nullable": true,
"validations": [
{
"method": "typeof",
"args": ["string"],
"message": "{{input}}类型错误, {{label}}应该为字符串"
},
{
"method": "minLength",
"args": [6],
"message": "{{label}}应该由6-18位大小写字母、数字和符号构成"
},
{
"method": "maxLength",
"args": [18],
"message": "{{label}}应该由6-18位大小写字母、数字和符号构成"
},
{
"method": "pattern",
"args": ["[0-9]+"],
"message": "{{label}}应该至少包含一个数字"
},
{
"method": "pattern",
"args": ["[A-Z]+"],
"message": "{{label}}应该至少包含一个大写字母"
},
{
"method": "pattern",
"args": ["[a-z]+"],
"message": "{{label}}应该至少包含一个小写字母"
},
{
"method": "pattern",
"args": ["[@#$&*\\+]+"],
"message": "{{label}}应该至少包含一个符号"
}
]
},
{
"label": "操作密码",
"name": "password2nd",
"type": "string",
"length": 256,
"comment": "操作密码",
"crypt": "PASSWORD",
"index": true,
"nullable": true,
"validations": [
{
"method": "typeof",
"args": ["string"],
"message": "{{input}}类型错误, {{label}}应该为字符串"
},
{
"method": "minLength",
"args": [6],
"message": "{{label}}应该由6-18位大小写字母、数字和符号构成"
},
{
"method": "maxLength",
"args": [18],
"message": "{{label}}应该由6-18位大小写字母、数字和符号构成"
},
{
"method": "pattern",
"args": ["[0-9]+"],
"message": "{{label}}应该至少包含一个数字"
},
{
"method": "pattern",
"args": ["[A-Z]+"],
"message": "{{label}}应该至少包含一个大写字母"
},
{
"method": "pattern",
"args": ["[a-z]+"],
"message": "{{label}}应该至少包含一个小写字母"
},
{
"method": "pattern",
"args": ["[@#$&*\\+]+"],
"message": "{{label}}应该至少包含一个符号"
}
]
},
{
"label": "姓名",
"name": "name",
"type": "string",
"length": 80,
"comment": "姓名",
"index": true,
"nullable": true,
"validations": [
{
"method": "typeof",
"args": ["string"],
"message": "{{input}}类型错误, {{label}}应该为字符串"
},
{
"method": "minLength",
"args": [2],
"message": "{{label}}至少需要2个字"
},
{
"method": "maxLength",
"args": [40],
"message": "{{label}}不能超过20个字"
}
]
},
{
"label": "身份证号码",
"name": "idcard",
"type": "string",
"length": 256,
"comment": "身份证号码",
"crypt": "AES",
"nullable": true,
"index": true,
"validations": [
{
"method": "typeof",
"args": ["string"],
"message": "{{input}}类型错误, {{label}}应该为字符串"
},
{
"method": "pattern",
"args": ["^(\\d{18})|(\\d{14}X)$"],
"message": "{{label}}格式错误"
}
]
},
{
"label": "API Key",
"name": "key",
"type": "string",
"length": 256,
"comment": "API Key",
"nullable": true,
"unique": true,
"validations": [
{
"method": "typeof",
"args": ["integer"],
"message": "{{input}}类型错误, {{label}}应该为数字"
},
{
"method": "pattern",
"args": ["^[0-9]{10}$"],
"message": " {{label}}应该由10位数字构成"
}
]
},
{
"label": "API 密钥",
"name": "secret",
"type": "string",
"length": 256,
"nullable": true,
"crypt": "AES",
"comment": "API 密钥",
"index": true,
"validations": [
{
"method": "typeof",
"args": ["string"],
"message": "{{input}}类型错误, {{label}}应该为字符串"
},
{
"method": "pattern",
"args": ["^[0-9A-Za-z@#$&*]{32}$"],
"message": "{{label}}应该由32位大小写字母、数字和符号构成"
}
]
},
{
"label": "扩展信息",
"name": "extra",
"type": "json",
"comment": "扩展信息",
"nullable": true
},
{
"label": "状态",
"comment": "用户状态 enabled 有效, disabled 无效",
"name": "status",
"type": "enum",
"default": "enabled",
"option": ["enabled", "disabled"],
"index": true,
"validations": [
{
"method": "typeof",
"args": ["string"],
"message": "{{input}}类型错误, {{label}}应该为字符串"
},
{
"method": "enum",
"args": ["enabled", "disabled"],
"message": "{{input}}不在许可范围, {{label}}应该为 enabled/disabled"
}
]
}
],
"relations": {},
"values": [
{
"name": "管理员",
"type": "admin",
"email": "xiang@iqka.com",
"mobile": null,
"password": "A123456p+",
"key": "8304925176",
"secret": "XMTdNRVigbgUiAPdiJCfaWgWcz2PaQXw",
"status": "enabled",
"extra": { "sex": "男" }
},
{
"name": "员工",
"type": "staff",
"email": "staff@iqka.com",
"mobile": null,
"password": "S123456p+",
"key": null,
"secret": null,
"status": "enabled",
"extra": { "sex": "女" }
},
{
"name": "用户",
"type": "user",
"email": null,
"mobile": "13900001111",
"password": "U123456p+",
"key": null,
"secret": null,
"status": "enabled",
"extra": { "sex": "女" }
},
{
"name": "机器人",
"type": "robot",
"email": null,
"mobile": null,
"password": null,
"key": "3845196072",
"secret": "wBeYjL7FjbcvpAdBrxtDFfjydsoPKhRN",
"status": "enabled",
"extra": { "sex": "女" }
}
],
"indexes": [
{
"comment": "类型邮箱唯一",
"name": "type_email_unique",
"columns": ["type", "email"],
"type": "unique"
},
{
"comment": "类型手机号唯一",
"name": "type_mobile_unique",
"columns": ["type", "mobile"],
"type": "unique"
}
],
"option": { "timestamps": true, "soft_deletes": true }
}