@uniai-fe/uds-templates 0.1.31 → 0.1.32
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/dist/styles.css
CHANGED
|
@@ -1010,10 +1010,12 @@
|
|
|
1010
1010
|
margin: 0;
|
|
1011
1011
|
display: block;
|
|
1012
1012
|
object-fit: contain;
|
|
1013
|
+
border-radius: var(--cctv-video-radius);
|
|
1013
1014
|
}
|
|
1014
1015
|
|
|
1015
1016
|
.cctv-video-overlay-container {
|
|
1016
1017
|
padding: var(--cctv-overlay-padding-y) var(--cctv-overlay-padding-x);
|
|
1018
|
+
border-radius: var(--cctv-video-radius);
|
|
1017
1019
|
position: absolute;
|
|
1018
1020
|
inset: 0;
|
|
1019
1021
|
z-index: 1;
|
package/package.json
CHANGED
package/src/cctv/apis/client.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useQuery, type UseQueryResult } from "@tanstack/react-query";
|
|
2
2
|
import type {
|
|
3
3
|
API_Req_CctvRtcToken,
|
|
4
|
-
|
|
4
|
+
API_Res_CctvCompany,
|
|
5
5
|
API_Res_CctvRtcToken,
|
|
6
6
|
} from "../types";
|
|
7
7
|
import { getQueryString } from "@uniai-fe/util-functions";
|
|
@@ -25,11 +25,10 @@ export const useQueryCctvCompanyList = ({
|
|
|
25
25
|
}: {
|
|
26
26
|
username: string;
|
|
27
27
|
url?: string;
|
|
28
|
-
}): UseQueryResult<
|
|
28
|
+
}): UseQueryResult<API_Res_CctvCompany> =>
|
|
29
29
|
useQuery({
|
|
30
30
|
queryKey: ["cctv_company_list", username, url],
|
|
31
31
|
queryFn: () => getClientCctvCompanyList({ username, url }),
|
|
32
|
-
enabled: Boolean(username),
|
|
33
32
|
});
|
|
34
33
|
|
|
35
34
|
export const postCctvRtcToken = async ({
|
|
@@ -59,5 +58,4 @@ export const useQueryCctvRtcToken = ({
|
|
|
59
58
|
useQuery({
|
|
60
59
|
queryKey: ["cctv_rtc_token", username, company_id, cam_id, url],
|
|
61
60
|
queryFn: () => postCctvRtcToken({ company_id, cam_id, username, url }),
|
|
62
|
-
enabled: Boolean(company_id && cam_id && username),
|
|
63
61
|
});
|
package/src/cctv/apis/server.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
API_Req_CctvRtcTokenOrigin,
|
|
10
10
|
API_Res_CctvCompanyGroup,
|
|
11
11
|
API_Res_CctvRtcToken,
|
|
12
|
+
API_Res_CctvCompany,
|
|
12
13
|
} from "../types";
|
|
13
14
|
|
|
14
15
|
export const GROUP_PRESET: API_Res_CctvCompanyGroup[] = [
|
|
@@ -144,7 +145,7 @@ export async function getServerCompanyList({
|
|
|
144
145
|
queryUrl,
|
|
145
146
|
searchParams,
|
|
146
147
|
}: API_Req_GetCompanyListParams): Promise<{
|
|
147
|
-
res:
|
|
148
|
+
res: API_Res_CctvCompany;
|
|
148
149
|
domain: string;
|
|
149
150
|
queryUrl: string;
|
|
150
151
|
options?: ResponseInit;
|
|
@@ -152,6 +153,10 @@ export async function getServerCompanyList({
|
|
|
152
153
|
const username = searchParams.get("username") || "";
|
|
153
154
|
const query_url = queryUrl || `/v1/users/${username}/cctvs`;
|
|
154
155
|
|
|
156
|
+
const alternateResponse = {
|
|
157
|
+
data: [],
|
|
158
|
+
total_count: 0,
|
|
159
|
+
};
|
|
155
160
|
const API_OPTION = {
|
|
156
161
|
domain,
|
|
157
162
|
queryUrl: query_url,
|
|
@@ -160,7 +165,7 @@ export async function getServerCompanyList({
|
|
|
160
165
|
|
|
161
166
|
if (!queryUrl && !username)
|
|
162
167
|
return {
|
|
163
|
-
res:
|
|
168
|
+
res: alternateResponse,
|
|
164
169
|
...API_OPTION,
|
|
165
170
|
options: { status: 400, statusText: "유저 아이디를 확인할 수 없습니다." },
|
|
166
171
|
};
|
|
@@ -172,19 +177,20 @@ export async function getServerCompanyList({
|
|
|
172
177
|
});
|
|
173
178
|
|
|
174
179
|
try {
|
|
175
|
-
const originRes:
|
|
176
|
-
await fetch(url)
|
|
177
|
-
).json();
|
|
180
|
+
const originRes: API_Res_CctvCompany = await (await fetch(url)).json();
|
|
178
181
|
|
|
179
182
|
// 응답 그룹/농장
|
|
180
|
-
const
|
|
181
|
-
const
|
|
183
|
+
const originGroups = originRes?.data || [];
|
|
184
|
+
const resGourps = classifyGroups(originGroups);
|
|
182
185
|
|
|
183
|
-
return {
|
|
186
|
+
return {
|
|
187
|
+
res: { data: resGourps, total_count: originRes.total_count || 0 },
|
|
188
|
+
...API_OPTION,
|
|
189
|
+
};
|
|
184
190
|
} catch (err) {
|
|
185
191
|
nextAPILog("GET", routeUrl, url, { err });
|
|
186
192
|
return {
|
|
187
|
-
res:
|
|
193
|
+
res: alternateResponse,
|
|
188
194
|
...API_OPTION,
|
|
189
195
|
options: { status: 500 },
|
|
190
196
|
};
|
|
@@ -20,10 +20,12 @@
|
|
|
20
20
|
margin: 0;
|
|
21
21
|
display: block;
|
|
22
22
|
object-fit: contain;
|
|
23
|
+
border-radius: var(--cctv-video-radius);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
.cctv-video-overlay-container {
|
|
26
27
|
padding: var(--cctv-overlay-padding-y) var(--cctv-overlay-padding-x);
|
|
28
|
+
border-radius: var(--cctv-video-radius);
|
|
27
29
|
|
|
28
30
|
position: absolute;
|
|
29
31
|
inset: 0;
|
package/src/cctv/types/api.ts
CHANGED
|
@@ -109,6 +109,16 @@ export interface API_Res_CctvCompanyGroup {
|
|
|
109
109
|
list: API_Res_CctvCompanyList[];
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
/**
|
|
113
|
+
* CCTV; API 업체 목록 조회 응답
|
|
114
|
+
* @property {API_Res_CctvCompanyGroup[]} data
|
|
115
|
+
* @property {number} total_count
|
|
116
|
+
*/
|
|
117
|
+
export interface API_Res_CctvCompany {
|
|
118
|
+
data: API_Res_CctvCompanyGroup[];
|
|
119
|
+
total_count: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
112
122
|
/**
|
|
113
123
|
* CCTV; 실시간 스트리밍 토큰 요청 (Next.js API 요청)
|
|
114
124
|
* @property {string} company_id 업체 id코드
|