@greatapps/greatauth 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@greatapps/greatauth",
3
+ "version": "0.2.0",
4
+ "description": "Schemas para GreatAuth (accounts, users)",
5
+ "main": "./src/product.js",
6
+ "type": "module"
7
+ }
@@ -0,0 +1,11 @@
1
+ import { properties } from "./properties.js";
2
+
3
+ export default {
4
+ product: "greatauth",
5
+ name: "accounts",
6
+ cache: { ttlView: 3600, ttlList: 0 },
7
+ summary: "Contas (tenants) globais da plataforma Great",
8
+ params: [],
9
+ properties: properties,
10
+ routes: {},
11
+ };
@@ -0,0 +1,78 @@
1
+ export const properties = {
2
+ id: {
3
+ type: "number",
4
+ filterable: true,
5
+ unique: true,
6
+ autoIncrement: true,
7
+ index: true,
8
+ },
9
+ deleted: {
10
+ type: "boolean",
11
+ default: false,
12
+ },
13
+ datetime_add: {
14
+ type: "date",
15
+ filterable: true,
16
+ },
17
+ datetime_alt: {
18
+ type: "date",
19
+ filterable: true,
20
+ updatable: false,
21
+ },
22
+ datetime_del: {
23
+ type: "date",
24
+ filterable: true,
25
+ },
26
+ name: {
27
+ type: "string",
28
+ searchable: true,
29
+ maxLength: 255,
30
+ interface: {
31
+ label: {
32
+ "pt-br": "Nome",
33
+ en: "Name",
34
+ },
35
+ description: {
36
+ "pt-br": "Nome da conta (tenant)",
37
+ en: "Account name (tenant)",
38
+ },
39
+ placeholder: {
40
+ "pt-br": "Nome",
41
+ en: "Name",
42
+ },
43
+ component: "input",
44
+ },
45
+ },
46
+ status: {
47
+ type: "string",
48
+ filterable: true,
49
+ maxLength: 20,
50
+ default: "active",
51
+ enum: ["active", "suspended", "inactive"],
52
+ },
53
+ config: {
54
+ type: "json",
55
+ default: {},
56
+ },
57
+ external_id: {
58
+ type: "string",
59
+ filterable: true,
60
+ maxLength: 255,
61
+ index: true,
62
+ },
63
+ products: {
64
+ type: "json",
65
+ default: [],
66
+ interface: {
67
+ label: {
68
+ "pt-br": "Produtos",
69
+ en: "Products",
70
+ },
71
+ description: {
72
+ "pt-br": "Produtos habilitados para esta conta",
73
+ en: "Products enabled for this account",
74
+ },
75
+ component: "select",
76
+ },
77
+ },
78
+ };
@@ -0,0 +1,10 @@
1
+ import { properties } from "./properties.js";
2
+
3
+ export default {
4
+ product: "greatauth",
5
+ name: "user_phones",
6
+ cache: { ttlView: 0, ttlList: 0 },
7
+ params: ["id_account"],
8
+ properties: properties,
9
+ routes: {},
10
+ };
@@ -0,0 +1,122 @@
1
+ export const properties = {
2
+ id: {
3
+ type: "number",
4
+ filterable: true,
5
+ unique: true,
6
+ autoIncrement: true,
7
+ index: true,
8
+ },
9
+ deleted: {
10
+ type: "boolean",
11
+ default: false,
12
+ filterable: true,
13
+ },
14
+ datetime_add: {
15
+ type: "date",
16
+ filterable: true,
17
+ updatable: false,
18
+ },
19
+ datetime_alt: {
20
+ type: "date",
21
+ filterable: true,
22
+ updatable: true,
23
+ },
24
+ datetime_del: {
25
+ type: "date",
26
+ filterable: true,
27
+ },
28
+ id_account: {
29
+ type: "number",
30
+ required: true,
31
+ updatable: false,
32
+ filterable: true,
33
+ reference: {
34
+ module: "accounts",
35
+ label: "name",
36
+ value: "id",
37
+ disabled: true,
38
+ },
39
+ interface: {
40
+ label: {
41
+ "pt-br": "Conta",
42
+ en: "Account",
43
+ },
44
+ component: "hidden",
45
+ },
46
+ },
47
+ id_user: {
48
+ type: "number",
49
+ required: true,
50
+ updatable: false,
51
+ filterable: true,
52
+ reference: {
53
+ module: "users",
54
+ label: "name",
55
+ value: "id",
56
+ disabled: true,
57
+ },
58
+ interface: {
59
+ label: {
60
+ "pt-br": "Usuário",
61
+ en: "User",
62
+ },
63
+ component: "hidden",
64
+ },
65
+ },
66
+ phone_number: {
67
+ type: "string",
68
+ required: true,
69
+ searchable: true,
70
+ maxLength: 50,
71
+ interface: {
72
+ label: {
73
+ "pt-br": "Telefone",
74
+ en: "Phone number",
75
+ },
76
+ component: "input",
77
+ },
78
+ },
79
+ label: {
80
+ type: "string",
81
+ default: "celular",
82
+ maxLength: 50,
83
+ filterable: true,
84
+ options: [
85
+ {
86
+ value: "celular",
87
+ title: { "pt-br": "Celular", en: "Mobile" },
88
+ },
89
+ {
90
+ value: "comercial",
91
+ title: { "pt-br": "Comercial", en: "Business" },
92
+ },
93
+ {
94
+ value: "residencial",
95
+ title: { "pt-br": "Residencial", en: "Home" },
96
+ },
97
+ {
98
+ value: "outro",
99
+ title: { "pt-br": "Outro", en: "Other" },
100
+ },
101
+ ],
102
+ interface: {
103
+ label: {
104
+ "pt-br": "Tipo",
105
+ en: "Label",
106
+ },
107
+ component: "select",
108
+ },
109
+ },
110
+ is_primary: {
111
+ type: "number",
112
+ default: 0,
113
+ filterable: true,
114
+ interface: {
115
+ label: {
116
+ "pt-br": "Principal",
117
+ en: "Primary",
118
+ },
119
+ component: "checkbox",
120
+ },
121
+ },
122
+ };
@@ -0,0 +1,10 @@
1
+ import { properties } from "./properties.js";
2
+
3
+ export default {
4
+ product: "greatauth",
5
+ name: "users",
6
+ cache: { ttlView: 30, ttlList: 0 },
7
+ params: ["id_account"],
8
+ properties: properties,
9
+ routes: {},
10
+ };
@@ -0,0 +1,160 @@
1
+ export const properties = {
2
+ id: {
3
+ type: "number",
4
+ filterable: true,
5
+ unique: true,
6
+ autoIncrement: true,
7
+ index: true,
8
+ },
9
+ deleted: {
10
+ type: "boolean",
11
+ default: false,
12
+ filterable: true,
13
+ },
14
+ datetime_add: {
15
+ type: "date",
16
+ filterable: true,
17
+ updatable: false,
18
+ },
19
+ datetime_alt: {
20
+ type: "date",
21
+ filterable: true,
22
+ updatable: true,
23
+ },
24
+ datetime_del: {
25
+ type: "date",
26
+ filterable: true,
27
+ },
28
+ id_account: {
29
+ type: "number",
30
+ required: true,
31
+ updatable: false,
32
+ filterable: true,
33
+ reference: {
34
+ module: "accounts",
35
+ label: "name",
36
+ value: "id",
37
+ disabled: true,
38
+ },
39
+ interface: {
40
+ label: {
41
+ "pt-br": "Conta",
42
+ en: "Account",
43
+ },
44
+ component: "select",
45
+ disabled: true,
46
+ },
47
+ },
48
+ name: {
49
+ type: "string",
50
+ searchable: true,
51
+ maxLength: 50,
52
+ interface: {
53
+ label: {
54
+ "pt-br": "Nome",
55
+ en: "Name",
56
+ },
57
+ component: "input",
58
+ },
59
+ },
60
+ last_name: {
61
+ type: "string",
62
+ searchable: true,
63
+ interface: {
64
+ label: {
65
+ "pt-br": "Sobrenome",
66
+ en: "Lastname",
67
+ },
68
+ component: "input",
69
+ },
70
+ },
71
+ email: {
72
+ type: "string",
73
+ required: true,
74
+ searchable: true,
75
+ filterable: true,
76
+ interface: {
77
+ label: {
78
+ "pt-br": "E-mail",
79
+ en: "E-mail",
80
+ },
81
+ component: "input",
82
+ format: "email",
83
+ },
84
+ },
85
+ password_hash: {
86
+ type: "string",
87
+ required: false,
88
+ filterable: false,
89
+ interface: {
90
+ label: {
91
+ "pt-br": "Hash da senha",
92
+ en: "Password hash",
93
+ },
94
+ component: "hidden",
95
+ },
96
+ },
97
+ profile: {
98
+ type: "string",
99
+ default: "collaborator",
100
+ filterable: true,
101
+ options: [
102
+ {
103
+ value: "viewer",
104
+ title: { "pt-br": "Visualizador", en: "Viewer" },
105
+ },
106
+ {
107
+ value: "collaborator",
108
+ title: { "pt-br": "Colaborador", en: "Collaborator" },
109
+ },
110
+ {
111
+ value: "admin",
112
+ title: { "pt-br": "Administrador", en: "Admin" },
113
+ },
114
+ {
115
+ value: "owner",
116
+ title: { "pt-br": "Proprietário", en: "Owner" },
117
+ },
118
+ {
119
+ value: "attendant",
120
+ title: { "pt-br": "Atendente", en: "Attendant" },
121
+ },
122
+ ],
123
+ interface: {
124
+ label: {
125
+ "pt-br": "Perfil de acesso",
126
+ en: "Profile",
127
+ },
128
+ component: "select",
129
+ },
130
+ },
131
+ photo: {
132
+ type: "string",
133
+ interface: {
134
+ label: {
135
+ "pt-br": "Foto",
136
+ en: "Photo",
137
+ },
138
+ component: "input",
139
+ },
140
+ },
141
+ last_login: {
142
+ type: "date",
143
+ filterable: true,
144
+ },
145
+ products: {
146
+ type: "json",
147
+ default: [],
148
+ interface: {
149
+ label: {
150
+ "pt-br": "Produtos",
151
+ en: "Products",
152
+ },
153
+ description: {
154
+ "pt-br": "Produtos habilitados para este usuário",
155
+ en: "Products enabled for this user",
156
+ },
157
+ component: "select",
158
+ },
159
+ },
160
+ };
package/src/product.js ADDED
@@ -0,0 +1,43 @@
1
+ /* Modules */
2
+
3
+ import accounts from "./modules/accounts/index.js";
4
+ import users from "./modules/users/index.js";
5
+ import user_phones from "./modules/user_phones/index.js";
6
+
7
+ /* Shared */
8
+
9
+ import { parameters } from "./shared/parameters.js";
10
+ import { responses } from "./shared/responses.js";
11
+
12
+ /* Product */
13
+
14
+ export default {
15
+ id: "great",
16
+ name: "great",
17
+ brand: "Great",
18
+ domain: "great.com.br",
19
+ summary: "Plataforma global de autenticação e gestão",
20
+ description: "Camada unificada de autenticação, usuários e contas",
21
+ routes: {
22
+ baseUrl: "/v1/:language/:id_wl/accounts/:id_account",
23
+ parameters: {
24
+ language: parameters.language,
25
+ id_wl: parameters.id_wl,
26
+ id_account: parameters.id_account,
27
+ },
28
+ },
29
+ modules: {
30
+ accounts,
31
+ users,
32
+ user_phones,
33
+ },
34
+ documentation: {
35
+ title: "Great Platform API",
36
+ description: "API para autenticação e gestão de contas/usuários",
37
+ contact: {
38
+ name: "Suporte Great",
39
+ email: "suporte@greatsoftwares.com.br",
40
+ },
41
+ },
42
+ responses: responses,
43
+ };
@@ -0,0 +1,17 @@
1
+ export const parameters = {
2
+ language: {
3
+ type: "string",
4
+ example: "pt-br",
5
+ description: "Idioma da rota",
6
+ },
7
+ id_wl: {
8
+ type: "string",
9
+ example: "1",
10
+ description: "ID do whitelabel",
11
+ },
12
+ id_account: {
13
+ type: "string",
14
+ example: "1",
15
+ description: "ID da conta",
16
+ },
17
+ };
@@ -0,0 +1,72 @@
1
+ export const responses = {
2
+ 400: {
3
+ description: "Requisição inválida",
4
+ content: {
5
+ "application/json": {
6
+ type: "object",
7
+ properties: {
8
+ status: { type: "number", options: [0, 1], value: 0 },
9
+ data: { type: "array", value: [] },
10
+ message: { type: "string", value: "Requisição inválida" },
11
+ },
12
+ required: ["status", "data"],
13
+ },
14
+ },
15
+ },
16
+ 401: {
17
+ description: "Não autorizado",
18
+ content: {
19
+ "application/json": {
20
+ type: "object",
21
+ properties: {
22
+ status: { type: "number", options: [0, 1], value: 0 },
23
+ data: { type: "array", value: [] },
24
+ message: { type: "string", value: "Não autorizado" },
25
+ },
26
+ required: ["status", "data"],
27
+ },
28
+ },
29
+ },
30
+ 403: {
31
+ description: "Acesso proibido",
32
+ content: {
33
+ "application/json": {
34
+ type: "object",
35
+ properties: {
36
+ status: { type: "number", options: [0, 1], value: 0 },
37
+ data: { type: "array", value: [] },
38
+ message: { type: "string", value: "Acesso proibido" },
39
+ },
40
+ required: ["status", "data"],
41
+ },
42
+ },
43
+ },
44
+ 404: {
45
+ description: "Rota não encontrada",
46
+ content: {
47
+ "application/json": {
48
+ type: "object",
49
+ properties: {
50
+ status: { type: "number", options: [0, 1], value: 0 },
51
+ data: { type: "array", value: [] },
52
+ message: { type: "string", value: "Rota não encontrada" },
53
+ },
54
+ required: ["status", "data"],
55
+ },
56
+ },
57
+ },
58
+ 500: {
59
+ description: "Erro interno do servidor",
60
+ content: {
61
+ "application/json": {
62
+ type: "object",
63
+ properties: {
64
+ status: { type: "number", options: [0, 1], value: 0 },
65
+ data: { type: "array", value: [] },
66
+ message: { type: "string", value: "Erro interno do servidor" },
67
+ },
68
+ required: ["status", "data"],
69
+ },
70
+ },
71
+ },
72
+ };