rl-core-front 0.2.0 → 0.4.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 +1 -1
- package/src/_services/api/schema.d.ts +238 -117
- package/src/_utils/filter.ts +15 -34
- package/src/components/app-shell.tsx +51 -1
- package/src/components/brand-header.tsx +23 -8
- package/src/components/brand-panel.tsx +41 -0
- package/src/components/index.ts +1 -0
- package/src/components/ui/button.tsx +5 -0
- package/src/components/ui/confirm-dialog.tsx +3 -1
- package/src/components/ui/data-table.tsx +13 -4
- package/src/components/ui/dialog.tsx +120 -21
- package/src/components/ui/filter-sheet.tsx +47 -25
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/segmented-control.tsx +74 -0
- package/src/contexts/brand-context.tsx +15 -0
- package/src/contexts/i18n-context.tsx +69 -4
- package/src/features/audit/audit-screen.tsx +13 -140
- package/src/features/audit/components/audit-diff.tsx +156 -0
- package/src/features/audit/components/index.ts +3 -0
- package/src/features/audit/components/record-audit-button.tsx +176 -0
- package/src/features/audit/enums/audit-data-action.enum.ts +20 -0
- package/src/features/audit/hooks/use-audit-trail.ts +9 -2
- package/src/features/audit/services/audit.service.ts +43 -1
- package/src/features/login/login-screen.tsx +86 -40
- package/src/features/logs/enums/error-type.enum.ts +21 -0
- package/src/features/logs/enums/request-outcome.enum.ts +14 -0
- package/src/features/logs/hooks/use-request-logs.ts +26 -3
- package/src/features/logs/logs-screen.tsx +2 -14
- package/src/features/logs/panels/index.ts +0 -1
- package/src/features/logs/panels/request-logs-panel.tsx +177 -25
- package/src/features/logs/services/logs.service.ts +13 -51
- package/src/features/notifications/components/notification-item.tsx +10 -8
- package/src/features/notifications/enums/notification-type.enum.ts +8 -0
- package/src/features/profile/profile-screen.tsx +2 -1
- package/src/features/rbac/panels/groups-panel.tsx +20 -7
- package/src/features/users/components/user-form-dialog.tsx +16 -7
- package/src/features/users/hooks/use-users.ts +9 -2
- package/src/hooks/use-filters.ts +25 -2
- package/src/hooks/use-list-query.ts +14 -1
- package/src/i18n/messages/en.ts +17 -5
- package/src/i18n/messages/pt.ts +18 -5
- package/src/index.ts +12 -1
- package/src/components/ui/filter-chips.tsx +0 -88
- package/src/features/logs/hooks/use-error-logs.ts +0 -65
- package/src/features/logs/panels/error-logs-panel.tsx +0 -183
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rl-core-front",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Telas e componentes Next.js do core: login com 2FA, usu\u00e1rios, RBAC, auditoria, logs e listagens com filtro din\u00e2mico",
|
|
5
5
|
"author": "Rodrigo Liberti",
|
|
6
6
|
"license": "MIT",
|
|
@@ -608,14 +608,14 @@ export interface paths {
|
|
|
608
608
|
patch?: never;
|
|
609
609
|
trace?: never;
|
|
610
610
|
};
|
|
611
|
-
"/audit/
|
|
611
|
+
"/audit/requests": {
|
|
612
612
|
parameters: {
|
|
613
613
|
query?: never;
|
|
614
614
|
header?: never;
|
|
615
615
|
path?: never;
|
|
616
616
|
cookie?: never;
|
|
617
617
|
};
|
|
618
|
-
get: operations["
|
|
618
|
+
get: operations["AuditController_requests"];
|
|
619
619
|
put?: never;
|
|
620
620
|
post?: never;
|
|
621
621
|
delete?: never;
|
|
@@ -624,46 +624,14 @@ export interface paths {
|
|
|
624
624
|
patch?: never;
|
|
625
625
|
trace?: never;
|
|
626
626
|
};
|
|
627
|
-
"/audit/
|
|
627
|
+
"/audit/requests/filter-schema": {
|
|
628
628
|
parameters: {
|
|
629
629
|
query?: never;
|
|
630
630
|
header?: never;
|
|
631
631
|
path?: never;
|
|
632
632
|
cookie?: never;
|
|
633
633
|
};
|
|
634
|
-
get: operations["
|
|
635
|
-
put?: never;
|
|
636
|
-
post?: never;
|
|
637
|
-
delete?: never;
|
|
638
|
-
options?: never;
|
|
639
|
-
head?: never;
|
|
640
|
-
patch?: never;
|
|
641
|
-
trace?: never;
|
|
642
|
-
};
|
|
643
|
-
"/audit/errors": {
|
|
644
|
-
parameters: {
|
|
645
|
-
query?: never;
|
|
646
|
-
header?: never;
|
|
647
|
-
path?: never;
|
|
648
|
-
cookie?: never;
|
|
649
|
-
};
|
|
650
|
-
get: operations["AuditController_errors"];
|
|
651
|
-
put?: never;
|
|
652
|
-
post?: never;
|
|
653
|
-
delete?: never;
|
|
654
|
-
options?: never;
|
|
655
|
-
head?: never;
|
|
656
|
-
patch?: never;
|
|
657
|
-
trace?: never;
|
|
658
|
-
};
|
|
659
|
-
"/audit/errors/filter-schema": {
|
|
660
|
-
parameters: {
|
|
661
|
-
query?: never;
|
|
662
|
-
header?: never;
|
|
663
|
-
path?: never;
|
|
664
|
-
cookie?: never;
|
|
665
|
-
};
|
|
666
|
-
get: operations["AuditController_errorsFilterSchema"];
|
|
634
|
+
get: operations["AuditController_requestsFilterSchema"];
|
|
667
635
|
put?: never;
|
|
668
636
|
post?: never;
|
|
669
637
|
delete?: never;
|
|
@@ -929,6 +897,20 @@ export interface components {
|
|
|
929
897
|
isActive: boolean;
|
|
930
898
|
roleIds?: string[];
|
|
931
899
|
};
|
|
900
|
+
ResourceResponse: {
|
|
901
|
+
/** Format: uuid */
|
|
902
|
+
id: string;
|
|
903
|
+
/** Format: date-time */
|
|
904
|
+
createdAt: string;
|
|
905
|
+
/** Format: date-time */
|
|
906
|
+
updatedAt: string;
|
|
907
|
+
/** Format: date-time */
|
|
908
|
+
deletedAt?: string | null;
|
|
909
|
+
/** @example users */
|
|
910
|
+
name: string;
|
|
911
|
+
description?: string | null;
|
|
912
|
+
isActive: boolean;
|
|
913
|
+
};
|
|
932
914
|
CreateResourceCommand: {
|
|
933
915
|
/** @example users */
|
|
934
916
|
name: string;
|
|
@@ -940,6 +922,20 @@ export interface components {
|
|
|
940
922
|
description?: string;
|
|
941
923
|
isActive?: boolean;
|
|
942
924
|
};
|
|
925
|
+
ActionResponse: {
|
|
926
|
+
/** Format: uuid */
|
|
927
|
+
id: string;
|
|
928
|
+
/** Format: date-time */
|
|
929
|
+
createdAt: string;
|
|
930
|
+
/** Format: date-time */
|
|
931
|
+
updatedAt: string;
|
|
932
|
+
/** Format: date-time */
|
|
933
|
+
deletedAt?: string | null;
|
|
934
|
+
/** @example read */
|
|
935
|
+
name: string;
|
|
936
|
+
description?: string | null;
|
|
937
|
+
isActive: boolean;
|
|
938
|
+
};
|
|
943
939
|
CreateActionCommand: {
|
|
944
940
|
/** @example read */
|
|
945
941
|
name: string;
|
|
@@ -951,6 +947,20 @@ export interface components {
|
|
|
951
947
|
description?: string;
|
|
952
948
|
isActive?: boolean;
|
|
953
949
|
};
|
|
950
|
+
ScopeResponse: {
|
|
951
|
+
/** Format: uuid */
|
|
952
|
+
id: string;
|
|
953
|
+
/** Format: date-time */
|
|
954
|
+
createdAt: string;
|
|
955
|
+
/** Format: date-time */
|
|
956
|
+
updatedAt: string;
|
|
957
|
+
/** Format: date-time */
|
|
958
|
+
deletedAt?: string | null;
|
|
959
|
+
/** @example any */
|
|
960
|
+
name: string;
|
|
961
|
+
description?: string | null;
|
|
962
|
+
isActive: boolean;
|
|
963
|
+
};
|
|
954
964
|
CreateScopeCommand: {
|
|
955
965
|
/**
|
|
956
966
|
* @description own | team | department | any
|
|
@@ -968,6 +978,29 @@ export interface components {
|
|
|
968
978
|
description?: string;
|
|
969
979
|
isActive?: boolean;
|
|
970
980
|
};
|
|
981
|
+
PermissionResponse: {
|
|
982
|
+
/** Format: uuid */
|
|
983
|
+
id: string;
|
|
984
|
+
/** Format: date-time */
|
|
985
|
+
createdAt: string;
|
|
986
|
+
/** Format: date-time */
|
|
987
|
+
updatedAt: string;
|
|
988
|
+
/** Format: date-time */
|
|
989
|
+
deletedAt?: string | null;
|
|
990
|
+
/** @example users:read:any */
|
|
991
|
+
code: string;
|
|
992
|
+
description?: string | null;
|
|
993
|
+
isActive: boolean;
|
|
994
|
+
/** Format: uuid */
|
|
995
|
+
resourceId: string;
|
|
996
|
+
/** Format: uuid */
|
|
997
|
+
actionId: string;
|
|
998
|
+
/** Format: uuid */
|
|
999
|
+
scopeId: string;
|
|
1000
|
+
resource: components["schemas"]["ResourceResponse"];
|
|
1001
|
+
action: components["schemas"]["ActionResponse"];
|
|
1002
|
+
scope: components["schemas"]["ScopeResponse"];
|
|
1003
|
+
};
|
|
971
1004
|
CreatePermissionCommand: {
|
|
972
1005
|
/**
|
|
973
1006
|
* @description resource:action:scope
|
|
@@ -985,6 +1018,40 @@ export interface components {
|
|
|
985
1018
|
description?: string;
|
|
986
1019
|
isActive?: boolean;
|
|
987
1020
|
};
|
|
1021
|
+
/** @enum {string} */
|
|
1022
|
+
GroupType: "company" | "department" | "team";
|
|
1023
|
+
RoleResponse: {
|
|
1024
|
+
/** Format: uuid */
|
|
1025
|
+
id: string;
|
|
1026
|
+
/** Format: date-time */
|
|
1027
|
+
createdAt: string;
|
|
1028
|
+
/** Format: date-time */
|
|
1029
|
+
updatedAt: string;
|
|
1030
|
+
/** Format: date-time */
|
|
1031
|
+
deletedAt?: string | null;
|
|
1032
|
+
/** @example admin */
|
|
1033
|
+
name: string;
|
|
1034
|
+
description?: string | null;
|
|
1035
|
+
isActive: boolean;
|
|
1036
|
+
permissions?: components["schemas"]["PermissionResponse"][];
|
|
1037
|
+
};
|
|
1038
|
+
GroupResponse: {
|
|
1039
|
+
/** Format: uuid */
|
|
1040
|
+
id: string;
|
|
1041
|
+
/** Format: date-time */
|
|
1042
|
+
createdAt: string;
|
|
1043
|
+
/** Format: date-time */
|
|
1044
|
+
updatedAt: string;
|
|
1045
|
+
/** Format: date-time */
|
|
1046
|
+
deletedAt?: string | null;
|
|
1047
|
+
name: string;
|
|
1048
|
+
description?: string | null;
|
|
1049
|
+
type: components["schemas"]["GroupType"];
|
|
1050
|
+
/** Format: uuid */
|
|
1051
|
+
parentId?: string | null;
|
|
1052
|
+
isActive: boolean;
|
|
1053
|
+
roles?: components["schemas"]["RoleResponse"][];
|
|
1054
|
+
};
|
|
988
1055
|
CreateGroupCommand: {
|
|
989
1056
|
name: string;
|
|
990
1057
|
description?: string;
|
|
@@ -1023,8 +1090,11 @@ export interface components {
|
|
|
1023
1090
|
permissionIds?: string[];
|
|
1024
1091
|
isActive?: boolean;
|
|
1025
1092
|
};
|
|
1026
|
-
/**
|
|
1027
|
-
|
|
1093
|
+
/**
|
|
1094
|
+
* @description 0 = sucesso, 1 = erro, 2 = abortada
|
|
1095
|
+
* @enum {number}
|
|
1096
|
+
*/
|
|
1097
|
+
RequestOutcome: 0 | 1 | 2;
|
|
1028
1098
|
AuditUserRefResponse: {
|
|
1029
1099
|
/** Format: uuid */
|
|
1030
1100
|
id: string;
|
|
@@ -1032,6 +1102,56 @@ export interface components {
|
|
|
1032
1102
|
/** @example admin@admin.com */
|
|
1033
1103
|
email: string;
|
|
1034
1104
|
};
|
|
1105
|
+
/**
|
|
1106
|
+
* @description 0 = validação, 1 = autenticação, 2 = não encontrado, 3 = limite, 4 = banco, 5 = integração, 6 = interno
|
|
1107
|
+
* @enum {number}
|
|
1108
|
+
*/
|
|
1109
|
+
ErrorType: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
1110
|
+
RequestLogResponse: {
|
|
1111
|
+
/** Format: uuid */
|
|
1112
|
+
id: string;
|
|
1113
|
+
/**
|
|
1114
|
+
* @description 0 = sucesso, 1 = erro, 2 = abortada
|
|
1115
|
+
* @example 0
|
|
1116
|
+
*/
|
|
1117
|
+
outcome: components["schemas"]["RequestOutcome"];
|
|
1118
|
+
/** @example Login */
|
|
1119
|
+
action?: string | null;
|
|
1120
|
+
/** @example POST */
|
|
1121
|
+
method?: string | null;
|
|
1122
|
+
/** @example /api/v1/users/9f3c… */
|
|
1123
|
+
path?: string | null;
|
|
1124
|
+
/** @example /users/:id */
|
|
1125
|
+
route?: string | null;
|
|
1126
|
+
/** @example 200 */
|
|
1127
|
+
statusCode?: number | null;
|
|
1128
|
+
/** @example 42 */
|
|
1129
|
+
durationMs?: number | null;
|
|
1130
|
+
userId?: string | null;
|
|
1131
|
+
user?: components["schemas"]["AuditUserRefResponse"] | null;
|
|
1132
|
+
/** @description HMAC do IP — não é reversível ao endereço original */
|
|
1133
|
+
ipHash?: string | null;
|
|
1134
|
+
userAgent?: string | null;
|
|
1135
|
+
/** Format: uuid */
|
|
1136
|
+
requestId?: string | null;
|
|
1137
|
+
/** @description 0 = validação, 1 = autenticação, 2 = não encontrado, 3 = limite, 4 = banco, 5 = integração, 6 = interno */
|
|
1138
|
+
errorType?: components["schemas"]["ErrorType"] | null;
|
|
1139
|
+
errorCode?: string | null;
|
|
1140
|
+
errorMessage?: string | null;
|
|
1141
|
+
errorStack?: string | null;
|
|
1142
|
+
/** Format: date-time */
|
|
1143
|
+
createdAt: string;
|
|
1144
|
+
/** Format: date-time */
|
|
1145
|
+
updatedAt: string;
|
|
1146
|
+
/** Format: date-time */
|
|
1147
|
+
deletedAt?: string | null;
|
|
1148
|
+
};
|
|
1149
|
+
PaginatedRequestLogsResponse: {
|
|
1150
|
+
items: components["schemas"]["RequestLogResponse"][];
|
|
1151
|
+
meta: components["schemas"]["PaginationMetaResponse"];
|
|
1152
|
+
};
|
|
1153
|
+
/** @enum {number} */
|
|
1154
|
+
AuditDataAction: 0 | 1 | 2;
|
|
1035
1155
|
AuditDataChangeResponse: {
|
|
1036
1156
|
/** Format: uuid */
|
|
1037
1157
|
id: string;
|
|
@@ -1056,8 +1176,8 @@ export interface components {
|
|
|
1056
1176
|
items: components["schemas"]["AuditDataChangeResponse"][];
|
|
1057
1177
|
meta: components["schemas"]["PaginationMetaResponse"];
|
|
1058
1178
|
};
|
|
1059
|
-
/** @enum {
|
|
1060
|
-
NotificationType:
|
|
1179
|
+
/** @enum {number} */
|
|
1180
|
+
NotificationType: 0 | 1 | 2 | 3;
|
|
1061
1181
|
UserNotificationResponse: {
|
|
1062
1182
|
/** Format: uuid */
|
|
1063
1183
|
id: string;
|
|
@@ -1083,8 +1203,8 @@ export interface components {
|
|
|
1083
1203
|
/** @example 3 */
|
|
1084
1204
|
unread: number;
|
|
1085
1205
|
};
|
|
1086
|
-
/** @enum {
|
|
1087
|
-
ScopeType:
|
|
1206
|
+
/** @enum {number} */
|
|
1207
|
+
ScopeType: 0 | 1 | 2;
|
|
1088
1208
|
NotificationTargetCommand: {
|
|
1089
1209
|
type: components["schemas"]["ScopeType"];
|
|
1090
1210
|
/** @description Id do usuário quando type=USER, nome do papel quando type=ROLE. Ignorado em ALL. */
|
|
@@ -1696,7 +1816,9 @@ export interface operations {
|
|
|
1696
1816
|
headers: {
|
|
1697
1817
|
[name: string]: unknown;
|
|
1698
1818
|
};
|
|
1699
|
-
content
|
|
1819
|
+
content: {
|
|
1820
|
+
"application/json": components["schemas"]["ResourceResponse"][];
|
|
1821
|
+
};
|
|
1700
1822
|
};
|
|
1701
1823
|
};
|
|
1702
1824
|
};
|
|
@@ -1713,11 +1835,13 @@ export interface operations {
|
|
|
1713
1835
|
};
|
|
1714
1836
|
};
|
|
1715
1837
|
responses: {
|
|
1716
|
-
|
|
1838
|
+
200: {
|
|
1717
1839
|
headers: {
|
|
1718
1840
|
[name: string]: unknown;
|
|
1719
1841
|
};
|
|
1720
|
-
content
|
|
1842
|
+
content: {
|
|
1843
|
+
"application/json": components["schemas"]["ResourceResponse"];
|
|
1844
|
+
};
|
|
1721
1845
|
};
|
|
1722
1846
|
};
|
|
1723
1847
|
};
|
|
@@ -1759,7 +1883,9 @@ export interface operations {
|
|
|
1759
1883
|
headers: {
|
|
1760
1884
|
[name: string]: unknown;
|
|
1761
1885
|
};
|
|
1762
|
-
content
|
|
1886
|
+
content: {
|
|
1887
|
+
"application/json": components["schemas"]["ResourceResponse"];
|
|
1888
|
+
};
|
|
1763
1889
|
};
|
|
1764
1890
|
};
|
|
1765
1891
|
};
|
|
@@ -1776,7 +1902,9 @@ export interface operations {
|
|
|
1776
1902
|
headers: {
|
|
1777
1903
|
[name: string]: unknown;
|
|
1778
1904
|
};
|
|
1779
|
-
content
|
|
1905
|
+
content: {
|
|
1906
|
+
"application/json": components["schemas"]["ActionResponse"][];
|
|
1907
|
+
};
|
|
1780
1908
|
};
|
|
1781
1909
|
};
|
|
1782
1910
|
};
|
|
@@ -1793,11 +1921,13 @@ export interface operations {
|
|
|
1793
1921
|
};
|
|
1794
1922
|
};
|
|
1795
1923
|
responses: {
|
|
1796
|
-
|
|
1924
|
+
200: {
|
|
1797
1925
|
headers: {
|
|
1798
1926
|
[name: string]: unknown;
|
|
1799
1927
|
};
|
|
1800
|
-
content
|
|
1928
|
+
content: {
|
|
1929
|
+
"application/json": components["schemas"]["ActionResponse"];
|
|
1930
|
+
};
|
|
1801
1931
|
};
|
|
1802
1932
|
};
|
|
1803
1933
|
};
|
|
@@ -1839,7 +1969,9 @@ export interface operations {
|
|
|
1839
1969
|
headers: {
|
|
1840
1970
|
[name: string]: unknown;
|
|
1841
1971
|
};
|
|
1842
|
-
content
|
|
1972
|
+
content: {
|
|
1973
|
+
"application/json": components["schemas"]["ActionResponse"];
|
|
1974
|
+
};
|
|
1843
1975
|
};
|
|
1844
1976
|
};
|
|
1845
1977
|
};
|
|
@@ -1856,7 +1988,9 @@ export interface operations {
|
|
|
1856
1988
|
headers: {
|
|
1857
1989
|
[name: string]: unknown;
|
|
1858
1990
|
};
|
|
1859
|
-
content
|
|
1991
|
+
content: {
|
|
1992
|
+
"application/json": components["schemas"]["ScopeResponse"][];
|
|
1993
|
+
};
|
|
1860
1994
|
};
|
|
1861
1995
|
};
|
|
1862
1996
|
};
|
|
@@ -1873,11 +2007,13 @@ export interface operations {
|
|
|
1873
2007
|
};
|
|
1874
2008
|
};
|
|
1875
2009
|
responses: {
|
|
1876
|
-
|
|
2010
|
+
200: {
|
|
1877
2011
|
headers: {
|
|
1878
2012
|
[name: string]: unknown;
|
|
1879
2013
|
};
|
|
1880
|
-
content
|
|
2014
|
+
content: {
|
|
2015
|
+
"application/json": components["schemas"]["ScopeResponse"];
|
|
2016
|
+
};
|
|
1881
2017
|
};
|
|
1882
2018
|
};
|
|
1883
2019
|
};
|
|
@@ -1919,7 +2055,9 @@ export interface operations {
|
|
|
1919
2055
|
headers: {
|
|
1920
2056
|
[name: string]: unknown;
|
|
1921
2057
|
};
|
|
1922
|
-
content
|
|
2058
|
+
content: {
|
|
2059
|
+
"application/json": components["schemas"]["ScopeResponse"];
|
|
2060
|
+
};
|
|
1923
2061
|
};
|
|
1924
2062
|
};
|
|
1925
2063
|
};
|
|
@@ -1936,7 +2074,9 @@ export interface operations {
|
|
|
1936
2074
|
headers: {
|
|
1937
2075
|
[name: string]: unknown;
|
|
1938
2076
|
};
|
|
1939
|
-
content
|
|
2077
|
+
content: {
|
|
2078
|
+
"application/json": components["schemas"]["PermissionResponse"][];
|
|
2079
|
+
};
|
|
1940
2080
|
};
|
|
1941
2081
|
};
|
|
1942
2082
|
};
|
|
@@ -1953,11 +2093,13 @@ export interface operations {
|
|
|
1953
2093
|
};
|
|
1954
2094
|
};
|
|
1955
2095
|
responses: {
|
|
1956
|
-
|
|
2096
|
+
200: {
|
|
1957
2097
|
headers: {
|
|
1958
2098
|
[name: string]: unknown;
|
|
1959
2099
|
};
|
|
1960
|
-
content
|
|
2100
|
+
content: {
|
|
2101
|
+
"application/json": components["schemas"]["PermissionResponse"];
|
|
2102
|
+
};
|
|
1961
2103
|
};
|
|
1962
2104
|
};
|
|
1963
2105
|
};
|
|
@@ -1999,7 +2141,9 @@ export interface operations {
|
|
|
1999
2141
|
headers: {
|
|
2000
2142
|
[name: string]: unknown;
|
|
2001
2143
|
};
|
|
2002
|
-
content
|
|
2144
|
+
content: {
|
|
2145
|
+
"application/json": components["schemas"]["PermissionResponse"];
|
|
2146
|
+
};
|
|
2003
2147
|
};
|
|
2004
2148
|
};
|
|
2005
2149
|
};
|
|
@@ -2016,7 +2160,9 @@ export interface operations {
|
|
|
2016
2160
|
headers: {
|
|
2017
2161
|
[name: string]: unknown;
|
|
2018
2162
|
};
|
|
2019
|
-
content
|
|
2163
|
+
content: {
|
|
2164
|
+
"application/json": components["schemas"]["GroupResponse"][];
|
|
2165
|
+
};
|
|
2020
2166
|
};
|
|
2021
2167
|
};
|
|
2022
2168
|
};
|
|
@@ -2033,11 +2179,13 @@ export interface operations {
|
|
|
2033
2179
|
};
|
|
2034
2180
|
};
|
|
2035
2181
|
responses: {
|
|
2036
|
-
|
|
2182
|
+
200: {
|
|
2037
2183
|
headers: {
|
|
2038
2184
|
[name: string]: unknown;
|
|
2039
2185
|
};
|
|
2040
|
-
content
|
|
2186
|
+
content: {
|
|
2187
|
+
"application/json": components["schemas"]["GroupResponse"];
|
|
2188
|
+
};
|
|
2041
2189
|
};
|
|
2042
2190
|
};
|
|
2043
2191
|
};
|
|
@@ -2056,7 +2204,9 @@ export interface operations {
|
|
|
2056
2204
|
headers: {
|
|
2057
2205
|
[name: string]: unknown;
|
|
2058
2206
|
};
|
|
2059
|
-
content
|
|
2207
|
+
content: {
|
|
2208
|
+
"application/json": components["schemas"]["GroupResponse"];
|
|
2209
|
+
};
|
|
2060
2210
|
};
|
|
2061
2211
|
};
|
|
2062
2212
|
};
|
|
@@ -2098,7 +2248,9 @@ export interface operations {
|
|
|
2098
2248
|
headers: {
|
|
2099
2249
|
[name: string]: unknown;
|
|
2100
2250
|
};
|
|
2101
|
-
content
|
|
2251
|
+
content: {
|
|
2252
|
+
"application/json": components["schemas"]["GroupResponse"];
|
|
2253
|
+
};
|
|
2102
2254
|
};
|
|
2103
2255
|
};
|
|
2104
2256
|
};
|
|
@@ -2155,7 +2307,9 @@ export interface operations {
|
|
|
2155
2307
|
headers: {
|
|
2156
2308
|
[name: string]: unknown;
|
|
2157
2309
|
};
|
|
2158
|
-
content
|
|
2310
|
+
content: {
|
|
2311
|
+
"application/json": components["schemas"]["RoleResponse"][];
|
|
2312
|
+
};
|
|
2159
2313
|
};
|
|
2160
2314
|
};
|
|
2161
2315
|
};
|
|
@@ -2172,11 +2326,13 @@ export interface operations {
|
|
|
2172
2326
|
};
|
|
2173
2327
|
};
|
|
2174
2328
|
responses: {
|
|
2175
|
-
|
|
2329
|
+
200: {
|
|
2176
2330
|
headers: {
|
|
2177
2331
|
[name: string]: unknown;
|
|
2178
2332
|
};
|
|
2179
|
-
content
|
|
2333
|
+
content: {
|
|
2334
|
+
"application/json": components["schemas"]["RoleResponse"];
|
|
2335
|
+
};
|
|
2180
2336
|
};
|
|
2181
2337
|
};
|
|
2182
2338
|
};
|
|
@@ -2195,7 +2351,9 @@ export interface operations {
|
|
|
2195
2351
|
headers: {
|
|
2196
2352
|
[name: string]: unknown;
|
|
2197
2353
|
};
|
|
2198
|
-
content
|
|
2354
|
+
content: {
|
|
2355
|
+
"application/json": components["schemas"]["RoleResponse"];
|
|
2356
|
+
};
|
|
2199
2357
|
};
|
|
2200
2358
|
};
|
|
2201
2359
|
};
|
|
@@ -2237,7 +2395,9 @@ export interface operations {
|
|
|
2237
2395
|
headers: {
|
|
2238
2396
|
[name: string]: unknown;
|
|
2239
2397
|
};
|
|
2240
|
-
content
|
|
2398
|
+
content: {
|
|
2399
|
+
"application/json": components["schemas"]["RoleResponse"];
|
|
2400
|
+
};
|
|
2241
2401
|
};
|
|
2242
2402
|
};
|
|
2243
2403
|
};
|
|
@@ -2253,11 +2413,13 @@ export interface operations {
|
|
|
2253
2413
|
};
|
|
2254
2414
|
requestBody?: never;
|
|
2255
2415
|
responses: {
|
|
2256
|
-
|
|
2416
|
+
200: {
|
|
2257
2417
|
headers: {
|
|
2258
2418
|
[name: string]: unknown;
|
|
2259
2419
|
};
|
|
2260
|
-
content
|
|
2420
|
+
content: {
|
|
2421
|
+
"application/json": components["schemas"]["RoleResponse"];
|
|
2422
|
+
};
|
|
2261
2423
|
};
|
|
2262
2424
|
};
|
|
2263
2425
|
};
|
|
@@ -2272,61 +2434,18 @@ export interface operations {
|
|
|
2272
2434
|
cookie?: never;
|
|
2273
2435
|
};
|
|
2274
2436
|
requestBody?: never;
|
|
2275
|
-
responses: {
|
|
2276
|
-
200: {
|
|
2277
|
-
headers: {
|
|
2278
|
-
[name: string]: unknown;
|
|
2279
|
-
};
|
|
2280
|
-
content?: never;
|
|
2281
|
-
};
|
|
2282
|
-
};
|
|
2283
|
-
};
|
|
2284
|
-
AuditController_changes: {
|
|
2285
|
-
parameters: {
|
|
2286
|
-
query?: {
|
|
2287
|
-
page?: number;
|
|
2288
|
-
limit?: number;
|
|
2289
|
-
search?: string;
|
|
2290
|
-
/** @description Coluna para ordenar (whitelist por endpoint) */
|
|
2291
|
-
sortBy?: string;
|
|
2292
|
-
sortDir?: "ASC" | "DESC";
|
|
2293
|
-
/** @description JSON, ex.: {"name":{"$SUBSTRING":"ana"}} */
|
|
2294
|
-
filter?: string;
|
|
2295
|
-
};
|
|
2296
|
-
header?: never;
|
|
2297
|
-
path?: never;
|
|
2298
|
-
cookie?: never;
|
|
2299
|
-
};
|
|
2300
|
-
requestBody?: never;
|
|
2301
|
-
responses: {
|
|
2302
|
-
200: {
|
|
2303
|
-
headers: {
|
|
2304
|
-
[name: string]: unknown;
|
|
2305
|
-
};
|
|
2306
|
-
content?: never;
|
|
2307
|
-
};
|
|
2308
|
-
};
|
|
2309
|
-
};
|
|
2310
|
-
AuditController_changesFilterSchema: {
|
|
2311
|
-
parameters: {
|
|
2312
|
-
query?: never;
|
|
2313
|
-
header?: never;
|
|
2314
|
-
path?: never;
|
|
2315
|
-
cookie?: never;
|
|
2316
|
-
};
|
|
2317
|
-
requestBody?: never;
|
|
2318
2437
|
responses: {
|
|
2319
2438
|
200: {
|
|
2320
2439
|
headers: {
|
|
2321
2440
|
[name: string]: unknown;
|
|
2322
2441
|
};
|
|
2323
2442
|
content: {
|
|
2324
|
-
"application/json": components["schemas"]["
|
|
2443
|
+
"application/json": components["schemas"]["RoleResponse"];
|
|
2325
2444
|
};
|
|
2326
2445
|
};
|
|
2327
2446
|
};
|
|
2328
2447
|
};
|
|
2329
|
-
|
|
2448
|
+
AuditController_requests: {
|
|
2330
2449
|
parameters: {
|
|
2331
2450
|
query?: {
|
|
2332
2451
|
page?: number;
|
|
@@ -2348,11 +2467,13 @@ export interface operations {
|
|
|
2348
2467
|
headers: {
|
|
2349
2468
|
[name: string]: unknown;
|
|
2350
2469
|
};
|
|
2351
|
-
content
|
|
2470
|
+
content: {
|
|
2471
|
+
"application/json": components["schemas"]["PaginatedRequestLogsResponse"];
|
|
2472
|
+
};
|
|
2352
2473
|
};
|
|
2353
2474
|
};
|
|
2354
2475
|
};
|
|
2355
|
-
|
|
2476
|
+
AuditController_requestsFilterSchema: {
|
|
2356
2477
|
parameters: {
|
|
2357
2478
|
query?: never;
|
|
2358
2479
|
header?: never;
|
package/src/_utils/filter.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { components } from "#core/_services/api/schema";
|
|
2
|
-
import {
|
|
2
|
+
import { fromIsoDay, toIsoDay } from "#core/_utils/calendar";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Tipos derivados do `openapi.json` (§5): o catálogo é servido pelo backend,
|
|
@@ -63,8 +63,20 @@ export const hasValue = (draft: FilterDraftValue | undefined): boolean => {
|
|
|
63
63
|
);
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Quantos filtros o botão "Filtros" anuncia.
|
|
68
|
+
*
|
|
69
|
+
* `ignore` são os campos que a barra da listagem controla: eles filtram de
|
|
70
|
+
* verdade, mas o contador não pode cobrá-los, senão a tela abre marcando 1 num
|
|
71
|
+
* painel onde não há nada marcado.
|
|
72
|
+
*/
|
|
73
|
+
export const activeFilterCount = (
|
|
74
|
+
values: FilterValues,
|
|
75
|
+
ignore: string[] = [],
|
|
76
|
+
): number =>
|
|
77
|
+
Object.entries(values).filter(
|
|
78
|
+
([field, draft]) => hasValue(draft) && !ignore.includes(field),
|
|
79
|
+
).length;
|
|
68
80
|
|
|
69
81
|
/**
|
|
70
82
|
* Ponta de um intervalo de datas em ISO **com o fuso de quem filtrou**.
|
|
@@ -280,34 +292,3 @@ const draftFrom = (
|
|
|
280
292
|
}
|
|
281
293
|
}
|
|
282
294
|
};
|
|
283
|
-
|
|
284
|
-
/** Resumo de um filtro ativo, para o chip. */
|
|
285
|
-
export const describeValue = (
|
|
286
|
-
field: FilterField,
|
|
287
|
-
draft: FilterDraftValue,
|
|
288
|
-
labels: { from: string; to: string; yes: string; no: string; locale: string },
|
|
289
|
-
): string => {
|
|
290
|
-
const show = (value: string): string =>
|
|
291
|
-
field.type === "DATE" || field.type === "DATETIME"
|
|
292
|
-
? formatDay(value, labels.locale)
|
|
293
|
-
: value;
|
|
294
|
-
|
|
295
|
-
if (field.type === "BOOLEAN") {
|
|
296
|
-
return draft.value === "true" ? labels.yes : labels.no;
|
|
297
|
-
}
|
|
298
|
-
if (draft.values?.length) {
|
|
299
|
-
const optionLabel = (value: string): string =>
|
|
300
|
-
field.options?.find((option) => option.value === value)?.label ?? value;
|
|
301
|
-
return draft.values.map(optionLabel).join(", ");
|
|
302
|
-
}
|
|
303
|
-
if (draft.from && draft.to) {
|
|
304
|
-
return `${show(draft.from)} – ${show(draft.to)}`;
|
|
305
|
-
}
|
|
306
|
-
if (draft.from) {
|
|
307
|
-
return `${labels.from} ${show(draft.from)}`;
|
|
308
|
-
}
|
|
309
|
-
if (draft.to) {
|
|
310
|
-
return `${labels.to} ${show(draft.to)}`;
|
|
311
|
-
}
|
|
312
|
-
return draft.value ?? "";
|
|
313
|
-
};
|