Compare commits
107
Commits
test
..
2ef6ba9329
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ef6ba9329 | ||
|
|
652073514b | ||
|
|
c4b786ac87 | ||
|
|
5a90fc9701 | ||
|
|
86e63ae869 | ||
|
|
d02dd76859 | ||
|
|
94ecf2b2ec | ||
|
|
17ff1b817d | ||
|
|
6769d8d485 | ||
|
|
860b3c7bab | ||
|
|
7d694a4c36 | ||
|
|
cae9e9a430 | ||
|
|
f90f8f6250 | ||
|
|
abb15cb2c7 | ||
|
|
b26837f258 | ||
|
|
f42602886e | ||
|
|
b8373829f0 | ||
|
|
2769c3c9f0 | ||
|
|
648d4d3a97 | ||
|
|
4baf253b7e | ||
|
|
e0c63df2a6 | ||
|
|
892923becc | ||
|
|
d3ea703204 | ||
|
|
70298b8f8f | ||
|
|
9fa9f3e699 | ||
|
|
d82531583c | ||
|
|
6240a285c2 | ||
|
|
f577ab575e | ||
|
|
0c3e3fc3fd | ||
|
|
6886c372aa | ||
|
|
8dd3dcb770 | ||
|
|
1a435b6074 | ||
|
|
492859dae3 | ||
|
|
18b59b5598 | ||
|
|
5fcdd7f06d | ||
|
|
1e149f7e41 | ||
|
|
aca3767a24 | ||
|
|
d51655f15e | ||
|
|
47dd32939f | ||
|
|
2e1891ab08 | ||
|
|
99d70cc8f7 | ||
|
|
9f1675e82d | ||
|
|
c2838be2ed | ||
|
|
b5c2941c0d | ||
|
|
d5c01d8d23 | ||
|
|
7118b0649a | ||
|
|
8f5346581e | ||
|
|
e43f2e30be | ||
|
|
397fd267e0 | ||
|
|
fe4b88350b | ||
|
|
537474e162 | ||
|
|
b5abdf3cf5 | ||
|
|
a2e457b5e8 | ||
|
|
05ddd417cd | ||
|
|
e70426af68 | ||
|
|
81b33e1322 | ||
|
|
588fcfbe90 | ||
|
|
ff2c126382 | ||
|
|
702daca29f | ||
|
|
8e9008a3c1 | ||
|
|
5c0c00aad4 | ||
|
|
e0949c6d73 | ||
|
|
0449bac8d5 | ||
|
|
d412c15c9d | ||
|
|
ed16a6ddad | ||
|
|
f06e2d41e0 | ||
|
|
7505269db3 | ||
|
|
15eeb6943d | ||
|
|
7e7ed46cea | ||
|
|
fd01786649 | ||
|
|
c48c1c2f09 | ||
|
|
9bcf3a3cdb | ||
|
|
4c5b987d98 | ||
|
|
f168403048 | ||
|
|
82ee1584e7 | ||
|
|
65cb918389 | ||
|
|
784baf9a2f | ||
|
|
7a85ac41cc | ||
|
|
9d4c9437cf | ||
|
|
68845aeae1 | ||
|
|
bbdca29337 | ||
|
|
c14c041daa | ||
|
|
a515a144eb | ||
|
|
54a6773905 | ||
|
|
d97087b4e9 | ||
|
|
ddb2449053 | ||
|
|
8aca07cdf7 | ||
|
|
0ba845d95a | ||
|
|
64b1fd5395 | ||
|
|
639bea70fa | ||
|
|
6a89ba059b | ||
|
|
ff83041585 | ||
|
|
e660be0bf4 | ||
|
|
62cdd57069 | ||
|
|
f8346ed5ef | ||
|
|
9656b9a9d1 | ||
|
|
97a58266bb | ||
|
|
8fc0cfa345 | ||
|
|
22f9c2287d | ||
|
|
9284f7d5c3 | ||
|
|
e6f27a4529 | ||
|
|
6a33d1c024 | ||
|
|
3b83789c15 | ||
|
|
55f0ab9af3 | ||
|
|
9b168a6112 | ||
|
|
c47937933e | ||
|
|
4744fe7d9a |
@@ -1,11 +1,8 @@
|
|||||||
# soda-live-admin
|
# soda-live-admin
|
||||||
|
|
||||||
## Project setup
|
## Project setup
|
||||||
|
|
||||||
Use Node.js 24.x for this project. Install dependencies from the lock file with:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
npm ci
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
### Compiles and hot-reloads for development
|
### Compiles and hot-reloads for development
|
||||||
|
|||||||
Generated
+22609
-7174
File diff suppressed because it is too large
Load Diff
+11
-20
@@ -2,9 +2,6 @@
|
|||||||
"name": "soda-live-admin",
|
"name": "soda-live-admin",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"engines": {
|
|
||||||
"node": "^24.0.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve_local": "vue-cli-service serve --mode local --port 8888",
|
"serve_local": "vue-cli-service serve --mode local --port 8888",
|
||||||
"serve": "vue-cli-service serve --port 8888",
|
"serve": "vue-cli-service serve --port 8888",
|
||||||
@@ -20,7 +17,7 @@
|
|||||||
"cropperjs": "^1.5.13",
|
"cropperjs": "^1.5.13",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"vue": "2.6.14",
|
"vue": "^2.6.11",
|
||||||
"vue-excel-xlsx": "^1.2.2",
|
"vue-excel-xlsx": "^1.2.2",
|
||||||
"vue-router": "^3.2.0",
|
"vue-router": "^3.2.0",
|
||||||
"vue-show-more-text": "^2.0.2",
|
"vue-show-more-text": "^2.0.2",
|
||||||
@@ -35,21 +32,21 @@
|
|||||||
"vuex": "^3.4.0"
|
"vuex": "^3.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/cli-plugin-babel": "~5.0.0",
|
"@vue/cli-plugin-babel": "~4.5.0",
|
||||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||||
"@vue/cli-plugin-router": "~5.0.0",
|
"@vue/cli-plugin-router": "~4.5.0",
|
||||||
"@vue/cli-plugin-vuex": "~5.0.0",
|
"@vue/cli-plugin-vuex": "~4.5.0",
|
||||||
"@vue/cli-service": "~5.0.0",
|
"@vue/cli-service": "~4.5.0",
|
||||||
"axios": "0.21.2",
|
"axios": "0.21.2",
|
||||||
"babel-eslint": "^10.1.0",
|
"babel-eslint": "^10.1.0",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^6.7.2",
|
||||||
"eslint-plugin-vue": "^7.20.0",
|
"eslint-plugin-vue": "^6.2.2",
|
||||||
"sass": "~1.32.0",
|
"sass": "~1.32.0",
|
||||||
"sass-loader": "^10.0.0",
|
"sass-loader": "^10.0.0",
|
||||||
"vue-cli-plugin-axios": "~0.0.4",
|
"vue-cli-plugin-axios": "~0.0.4",
|
||||||
"vue-cli-plugin-vuetify": "~2.4.5",
|
"vue-cli-plugin-vuetify": "~2.4.5",
|
||||||
"vue-template-compiler": "2.6.14",
|
"vue-template-compiler": "^2.6.11",
|
||||||
"vuetify-loader": "1.7.3"
|
"vuetify-loader": "^1.7.0"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
@@ -64,13 +61,7 @@
|
|||||||
"parser": "babel-eslint"
|
"parser": "babel-eslint"
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off"
|
||||||
"vue/valid-v-slot": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"allowModifiers": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
|
|||||||
+1
-22
@@ -20,23 +20,6 @@ export const SUB_BANNER_PLACEMENTS = [
|
|||||||
{value: 'CONTENT_RECOMMENDATION', text: '콘텐츠'}
|
{value: 'CONTENT_RECOMMENDATION', text: '콘텐츠'}
|
||||||
]
|
]
|
||||||
|
|
||||||
export const SUB_BANNER_LANGS = [
|
|
||||||
{value: 'KO', text: '한국어'},
|
|
||||||
{value: 'JA', text: '일본어'},
|
|
||||||
{value: 'EN', text: '영어'}
|
|
||||||
]
|
|
||||||
|
|
||||||
export const SUB_BANNER_DEFAULT_LANG = 'KO'
|
|
||||||
|
|
||||||
export function langLabel(lang) {
|
|
||||||
const found = SUB_BANNER_LANGS.find((item) => item.value === lang)
|
|
||||||
return found ? found.text : ''
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isSubBannerLang(lang) {
|
|
||||||
return SUB_BANNER_LANGS.some((item) => item.value === lang)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function placementLabel(placement) {
|
export function placementLabel(placement) {
|
||||||
const found = SUB_BANNER_PLACEMENTS.find((item) => item.value === placement)
|
const found = SUB_BANNER_PLACEMENTS.find((item) => item.value === placement)
|
||||||
return found ? found.text : ''
|
return found ? found.text : ''
|
||||||
@@ -167,8 +150,6 @@ export function createSubBannerForm(banner = {}) {
|
|||||||
return {
|
return {
|
||||||
id: banner.id === undefined ? null : banner.id,
|
id: banner.id === undefined ? null : banner.id,
|
||||||
placement: banner.placement || SUB_BANNER_PLACEMENTS[0].value,
|
placement: banner.placement || SUB_BANNER_PLACEMENTS[0].value,
|
||||||
// 저장된 언어가 있으면 그대로 사용하고, 신규 등록일 때만 KO 를 기본값으로 쓴다.
|
|
||||||
lang: isSubBannerLang(banner.lang) ? banner.lang : SUB_BANNER_DEFAULT_LANG,
|
|
||||||
image: null,
|
image: null,
|
||||||
image_url: banner.imageUrl || null,
|
image_url: banner.imageUrl || null,
|
||||||
web_url: banner.webUrl === null || banner.webUrl === undefined ? '' : String(banner.webUrl),
|
web_url: banner.webUrl === null || banner.webUrl === undefined ? '' : String(banner.webUrl),
|
||||||
@@ -255,9 +236,7 @@ function baseRequest(form) {
|
|||||||
placement: form.placement,
|
placement: form.placement,
|
||||||
webUrl: urls.webUrl,
|
webUrl: urls.webUrl,
|
||||||
androidDeepLink: urls.androidDeepLink,
|
androidDeepLink: urls.androidDeepLink,
|
||||||
iosDeepLink: urls.iosDeepLink,
|
iosDeepLink: urls.iosDeepLink
|
||||||
// 언어는 생성·수정 모두 현재 선택을 정규 대문자 코드로 항상 보낸다.
|
|
||||||
lang: isSubBannerLang(form.lang) ? form.lang : SUB_BANNER_DEFAULT_LANG
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,9 +66,6 @@
|
|||||||
<th class="text-center">
|
<th class="text-center">
|
||||||
이미지
|
이미지
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">
|
|
||||||
언어
|
|
||||||
</th>
|
|
||||||
<th class="text-center">
|
<th class="text-center">
|
||||||
웹 URL
|
웹 URL
|
||||||
</th>
|
</th>
|
||||||
@@ -102,7 +99,6 @@
|
|||||||
class="list-image"
|
class="list-image"
|
||||||
>
|
>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ langText(item) }}</td>
|
|
||||||
<td>{{ item.webUrl || '-' }}</td>
|
<td>{{ item.webUrl || '-' }}</td>
|
||||||
<td>{{ item.androidDeepLink || '-' }}</td>
|
<td>{{ item.androidDeepLink || '-' }}</td>
|
||||||
<td>{{ item.iosDeepLink || '-' }}</td>
|
<td>{{ item.iosDeepLink || '-' }}</td>
|
||||||
@@ -125,7 +121,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr v-if="sub_banners.length === 0">
|
<tr v-if="sub_banners.length === 0">
|
||||||
<td
|
<td
|
||||||
colspan="9"
|
colspan="8"
|
||||||
class="text-center"
|
class="text-center"
|
||||||
>
|
>
|
||||||
등록된 배너가 없습니다.
|
등록된 배너가 없습니다.
|
||||||
@@ -166,30 +162,6 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-text>
|
|
||||||
<v-row align="center">
|
|
||||||
<v-col cols="4">
|
|
||||||
<label for="sub-banner-lang">언어</label>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="8">
|
|
||||||
<v-select
|
|
||||||
id="sub-banner-lang"
|
|
||||||
v-model="sub_banner.lang"
|
|
||||||
:items="langs"
|
|
||||||
item-text="text"
|
|
||||||
item-value="value"
|
|
||||||
label="언어 선택"
|
|
||||||
:error-messages="form_errors.lang"
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-row>
|
|
||||||
<v-col class="guide-text">
|
|
||||||
영어(EN)는 저장과 목록 조회는 가능하지만 현재 앱 공개 국가 매핑(JP → 일본어, 그 외 → 한국어)에서는 노출되지 않습니다.
|
|
||||||
배너 소재 언어와 연결된 이벤트 언어는 운영자가 직접 맞춰 주세요.
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-card-text>
|
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-row align="center">
|
<v-row align="center">
|
||||||
<v-col cols="4">
|
<v-col cols="4">
|
||||||
@@ -367,9 +339,7 @@ import {
|
|||||||
buildSubBannerUpdateRequest,
|
buildSubBannerUpdateRequest,
|
||||||
createSubBannerForm,
|
createSubBannerForm,
|
||||||
formatScheduleRange,
|
formatScheduleRange,
|
||||||
langLabel,
|
|
||||||
scheduleStatus,
|
scheduleStatus,
|
||||||
SUB_BANNER_LANGS,
|
|
||||||
SUB_BANNER_PLACEMENTS,
|
SUB_BANNER_PLACEMENTS,
|
||||||
validateSubBannerForm
|
validateSubBannerForm
|
||||||
} from "@/utils/sub_banner"
|
} from "@/utils/sub_banner"
|
||||||
@@ -385,7 +355,6 @@ export default {
|
|||||||
show_write_dialog: false,
|
show_write_dialog: false,
|
||||||
show_delete_confirm_dialog: false,
|
show_delete_confirm_dialog: false,
|
||||||
placements: SUB_BANNER_PLACEMENTS,
|
placements: SUB_BANNER_PLACEMENTS,
|
||||||
langs: SUB_BANNER_LANGS,
|
|
||||||
selected_placement: SUB_BANNER_PLACEMENTS[0].value,
|
selected_placement: SUB_BANNER_PLACEMENTS[0].value,
|
||||||
sub_banners: [],
|
sub_banners: [],
|
||||||
selected_sub_banner: {},
|
selected_sub_banner: {},
|
||||||
@@ -407,16 +376,6 @@ export default {
|
|||||||
this.$dialog.notify.success(message)
|
this.$dialog.notify.success(message)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 400 등 4xx 는 ApiResponse 가 아닌 표준 Spring Boot body 일 수 있어 단정하지 않는다.
|
|
||||||
clientErrorMessage(error) {
|
|
||||||
const response = error && error.response
|
|
||||||
if (!response || response.status < 400 || response.status >= 500) return null
|
|
||||||
|
|
||||||
const body = response.data
|
|
||||||
const message = body && typeof body === 'object' ? (body.message || body.error) : null
|
|
||||||
return message || '입력값을 서버가 거부했습니다. 값을 확인한 뒤 다시 시도해 주세요.'
|
|
||||||
},
|
|
||||||
|
|
||||||
imageAdd(payload) {
|
imageAdd(payload) {
|
||||||
const file = payload
|
const file = payload
|
||||||
|
|
||||||
@@ -468,11 +427,6 @@ export default {
|
|||||||
return scheduleStatus(subBanner)
|
return scheduleStatus(subBanner)
|
||||||
},
|
},
|
||||||
|
|
||||||
langText(subBanner) {
|
|
||||||
// lang 이 없는 응답을 KO 로 간주하지 않는다.
|
|
||||||
return langLabel(subBanner.lang) || '-'
|
|
||||||
},
|
|
||||||
|
|
||||||
validate() {
|
validate() {
|
||||||
const errors = validateSubBannerForm(
|
const errors = validateSubBannerForm(
|
||||||
this.sub_banner,
|
this.sub_banner,
|
||||||
@@ -526,15 +480,9 @@ export default {
|
|||||||
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const clientError = this.clientErrorMessage(e)
|
// 결과가 불명확하므로 자동 재시도 없이 중복 전송을 막고 목록으로 상태를 확인한다.
|
||||||
if (clientError !== null) {
|
this.submit_blocked = true
|
||||||
// 서버가 확실히 거부했으므로 입력값·선택 파일·날짜를 그대로 두고 재전송도 막지 않는다.
|
this.notifyError('응답을 받지 못했습니다. 등록 여부를 목록에서 확인해 주세요.')
|
||||||
this.notifyError(clientError)
|
|
||||||
} else {
|
|
||||||
// 결과가 불명확하므로 자동 재시도 없이 중복 전송을 막고 목록으로 상태를 확인한다.
|
|
||||||
this.submit_blocked = true
|
|
||||||
this.notifyError('응답을 받지 못했습니다. 등록 여부를 목록에서 확인해 주세요.')
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
this.is_loading = false
|
this.is_loading = false
|
||||||
}
|
}
|
||||||
@@ -573,13 +521,8 @@ export default {
|
|||||||
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const clientError = this.clientErrorMessage(e)
|
this.submit_blocked = true
|
||||||
if (clientError !== null) {
|
this.notifyError('응답을 받지 못했습니다. 수정 여부를 목록에서 확인해 주세요.')
|
||||||
this.notifyError(clientError)
|
|
||||||
} else {
|
|
||||||
this.submit_blocked = true
|
|
||||||
this.notifyError('응답을 받지 못했습니다. 수정 여부를 목록에서 확인해 주세요.')
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
this.is_loading = false
|
this.is_loading = false
|
||||||
}
|
}
|
||||||
@@ -618,11 +561,6 @@ export default {
|
|||||||
if (res.status === 200 && res.data.success === true) {
|
if (res.status === 200 && res.data.success === true) {
|
||||||
// 서버가 id 오름차순으로 내려주므로 재정렬하지 않고 전부 표시한다.
|
// 서버가 id 오름차순으로 내려주므로 재정렬하지 않고 전부 표시한다.
|
||||||
this.sub_banners = Array.isArray(res.data.data) ? res.data.data : []
|
this.sub_banners = Array.isArray(res.data.data) ? res.data.data : []
|
||||||
|
|
||||||
// 응답에 lang 이 없으면 KO 로 간주하지 않고 계약 미충족을 알린다.
|
|
||||||
if (this.sub_banners.some((item) => !item || item.lang === undefined)) {
|
|
||||||
this.notifyError('목록 응답에 lang 이 없습니다. 언어 계약이 적용된 서버인지 확인해 주세요.')
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// 조회 실패를 빈 목록으로 오인하지 않는다.
|
// 조회 실패를 빈 목록으로 오인하지 않는다.
|
||||||
this.notifyError(res.data.message || '목록을 불러오지 못했습니다. 다시 시도해 주세요.')
|
this.notifyError(res.data.message || '목록을 불러오지 못했습니다. 다시 시도해 주세요.')
|
||||||
|
|||||||
+3
-148
@@ -38,7 +38,6 @@ const {
|
|||||||
buildSubBannerUpdateRequest,
|
buildSubBannerUpdateRequest,
|
||||||
createSubBannerForm,
|
createSubBannerForm,
|
||||||
formatScheduleRange,
|
formatScheduleRange,
|
||||||
langLabel,
|
|
||||||
normalizeUrls,
|
normalizeUrls,
|
||||||
placementLabel,
|
placementLabel,
|
||||||
resolveSubBannerTarget,
|
resolveSubBannerTarget,
|
||||||
@@ -56,7 +55,6 @@ const envelope = (data, success = true, message = null) => ({ success, message,
|
|||||||
const subBanner = (overrides = {}) => ({
|
const subBanner = (overrides = {}) => ({
|
||||||
id: 1,
|
id: 1,
|
||||||
placement: 'HOME_RECOMMENDATION',
|
placement: 'HOME_RECOMMENDATION',
|
||||||
lang: 'KO',
|
|
||||||
imageUrl: 'https://cdn.example.test/promo.jpg',
|
imageUrl: 'https://cdn.example.test/promo.jpg',
|
||||||
webUrl: 'https://example.test/promo',
|
webUrl: 'https://example.test/promo',
|
||||||
androidDeepLink: null,
|
androidDeepLink: null,
|
||||||
@@ -188,8 +186,7 @@ test('주소 수정: 전부 비우면 오류, 한 필드만 비우면 해당 값
|
|||||||
placement: 'HOME_RECOMMENDATION',
|
placement: 'HOME_RECOMMENDATION',
|
||||||
webUrl: 'https://example.test/promo',
|
webUrl: 'https://example.test/promo',
|
||||||
androidDeepLink: 'sampleapp://promo',
|
androidDeepLink: 'sampleapp://promo',
|
||||||
iosDeepLink: null,
|
iosDeepLink: null
|
||||||
lang: 'KO'
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -270,8 +267,7 @@ test('등록 요청: 네 기본 필드는 항상 보내고 날짜 미입력은
|
|||||||
placement: 'CONTENT_RECOMMENDATION',
|
placement: 'CONTENT_RECOMMENDATION',
|
||||||
webUrl: 'https://example.test/promo',
|
webUrl: 'https://example.test/promo',
|
||||||
androidDeepLink: 'sampleapp://promo',
|
androidDeepLink: 'sampleapp://promo',
|
||||||
iosDeepLink: null,
|
iosDeepLink: null
|
||||||
lang: 'KO'
|
|
||||||
})
|
})
|
||||||
assert.deepEqual(buildSubBannerCreateRequest({ ...base, start_date: '2026-11-01T09:30' }).startDate, '2026-11-01 09:30')
|
assert.deepEqual(buildSubBannerCreateRequest({ ...base, start_date: '2026-11-01T09:30' }).startDate, '2026-11-01 09:30')
|
||||||
assert.deepEqual(buildSubBannerCreateRequest({ ...base, end_date: '2026-11-30T23:59' }).endDate, '2026-11-30 23:59')
|
assert.deepEqual(buildSubBannerCreateRequest({ ...base, end_date: '2026-11-30T23:59' }).endDate, '2026-11-30 23:59')
|
||||||
@@ -287,8 +283,7 @@ test('수정 요청: 미변경 경계는 생략해 보존하고 지운 경계만
|
|||||||
placement: 'HOME_RECOMMENDATION',
|
placement: 'HOME_RECOMMENDATION',
|
||||||
webUrl: 'https://example.test/promo',
|
webUrl: 'https://example.test/promo',
|
||||||
androidDeepLink: 'sampleapp://promo',
|
androidDeepLink: 'sampleapp://promo',
|
||||||
iosDeepLink: null,
|
iosDeepLink: null
|
||||||
lang: 'KO'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// loaded date 재전송: 값이 같으면 생략해 저장 값을 보존한다.
|
// loaded date 재전송: 값이 같으면 생략해 저장 값을 보존한다.
|
||||||
@@ -399,7 +394,6 @@ test('등록: image 와 application/json request 파트를 보내고 목록을
|
|||||||
webUrl: 'https://example.test/promo',
|
webUrl: 'https://example.test/promo',
|
||||||
androidDeepLink: null,
|
androidDeepLink: null,
|
||||||
iosDeepLink: null,
|
iosDeepLink: null,
|
||||||
lang: 'KO',
|
|
||||||
startDate: '2026-11-01 09:30'
|
startDate: '2026-11-01 09:30'
|
||||||
})
|
})
|
||||||
assert.deepEqual(successes, ['등록되었습니다.'])
|
assert.deepEqual(successes, ['등록되었습니다.'])
|
||||||
@@ -457,7 +451,6 @@ test('수정: 목록 객체로 폼을 채우고 일정만 바꾸면 image 를
|
|||||||
webUrl: 'https://example.test/promo',
|
webUrl: 'https://example.test/promo',
|
||||||
androidDeepLink: 'sampleapp://promo',
|
androidDeepLink: 'sampleapp://promo',
|
||||||
iosDeepLink: null,
|
iosDeepLink: null,
|
||||||
lang: 'KO',
|
|
||||||
endDate: '2026-12-31 23:59'
|
endDate: '2026-12-31 23:59'
|
||||||
})
|
})
|
||||||
assert.deepEqual(successes, ['수정되었습니다.'])
|
assert.deepEqual(successes, ['수정되었습니다.'])
|
||||||
@@ -557,144 +550,6 @@ test('중복 제출 방지: 진행 중 재호출과 timeout 이후 재전송을
|
|||||||
assert.equal(timeoutPage.errors.length, 1)
|
assert.equal(timeoutPage.errors.length, 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('언어: 신규 기본값은 KO 이고 선택한 코드가 정규 대문자로 직렬화된다', () => {
|
|
||||||
assert.equal(createSubBannerForm().lang, 'KO')
|
|
||||||
assert.equal(langLabel('KO'), '한국어')
|
|
||||||
assert.equal(langLabel('JA'), '일본어')
|
|
||||||
assert.equal(langLabel('EN'), '영어')
|
|
||||||
assert.equal(langLabel('ko'), '')
|
|
||||||
|
|
||||||
for (const lang of ['KO', 'JA', 'EN']) {
|
|
||||||
const created = buildSubBannerCreateRequest(form({ lang, web_url: 'https://example.test/promo' }))
|
|
||||||
assert.deepEqual(created, {
|
|
||||||
placement: 'HOME_RECOMMENDATION',
|
|
||||||
webUrl: 'https://example.test/promo',
|
|
||||||
androidDeepLink: null,
|
|
||||||
iosDeepLink: null,
|
|
||||||
lang
|
|
||||||
})
|
|
||||||
|
|
||||||
const saved = subBanner({ lang })
|
|
||||||
const updated = buildSubBannerUpdateRequest(createSubBannerForm(saved), saved)
|
|
||||||
assert.deepEqual(Object.keys(updated), ['placement', 'webUrl', 'androidDeepLink', 'iosDeepLink', 'lang'])
|
|
||||||
assert.equal(updated.lang, lang)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
test('언어: 수정 폼은 저장된 JA/EN 으로 미리 선택되고 다른 값만 바꿔도 보존된다', async () => {
|
|
||||||
stubFormData()
|
|
||||||
const { vm } = page()
|
|
||||||
const calls = []
|
|
||||||
Vue.axios = {
|
|
||||||
put: async (...args) => { calls.push(args); return { status: 200, data: envelope(subBanner({ lang: 'JA' })) } },
|
|
||||||
get: async () => ({ status: 200, data: envelope([subBanner({ lang: 'JA' })]) })
|
|
||||||
}
|
|
||||||
|
|
||||||
const saved = subBanner({ id: 55, lang: 'JA', startDate: '2026-11-01 09:30', endDate: '2026-11-30 23:59' })
|
|
||||||
vm.showModifyDialog(saved)
|
|
||||||
assert.equal(vm.sub_banner.lang, 'JA')
|
|
||||||
|
|
||||||
// 이미지와 종료 일시만 바꿔도 저장된 언어가 그대로 전송된다.
|
|
||||||
vm.imageAdd({ name: 'new.jpg', type: 'image/jpeg' })
|
|
||||||
vm.sub_banner.end_date = '2026-12-31T23:59'
|
|
||||||
await vm.modify()
|
|
||||||
|
|
||||||
assert.equal(calls[0][0], '/admin/sub-banners/55')
|
|
||||||
assert.equal(calls[0][1].get('image').name, 'new.jpg')
|
|
||||||
assert.deepEqual(requestOf(calls[0][1]), {
|
|
||||||
placement: 'HOME_RECOMMENDATION',
|
|
||||||
webUrl: 'https://example.test/promo',
|
|
||||||
androidDeepLink: null,
|
|
||||||
iosDeepLink: null,
|
|
||||||
lang: 'JA',
|
|
||||||
endDate: '2026-12-31 23:59'
|
|
||||||
})
|
|
||||||
|
|
||||||
const en = subBanner({ id: 56, lang: 'EN' })
|
|
||||||
vm.showModifyDialog(en)
|
|
||||||
assert.equal(vm.sub_banner.lang, 'EN')
|
|
||||||
|
|
||||||
// 언어만 바꿔도 나머지 값은 그대로다.
|
|
||||||
vm.sub_banner.lang = 'KO'
|
|
||||||
await vm.modify()
|
|
||||||
assert.deepEqual(requestOf(calls[1][1]), {
|
|
||||||
placement: 'HOME_RECOMMENDATION',
|
|
||||||
webUrl: 'https://example.test/promo',
|
|
||||||
androidDeepLink: null,
|
|
||||||
iosDeepLink: null,
|
|
||||||
lang: 'KO'
|
|
||||||
})
|
|
||||||
assert.equal(calls[1][1].has('image'), false)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('언어 오류: 400 Boot body 와 success=false 모두 입력·이미지·날짜를 보존한다', async () => {
|
|
||||||
stubFormData()
|
|
||||||
const bootError = {
|
|
||||||
response: {
|
|
||||||
status: 400,
|
|
||||||
data: { timestamp: '2026-11-01T00:00:00.000+00:00', status: 400, error: 'Bad Request', message: '지원하지 않는 언어입니다.', path: '/admin/sub-banners' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const { vm, errors, successes } = page()
|
|
||||||
Vue.axios = {
|
|
||||||
post: async () => { throw bootError },
|
|
||||||
get: async () => ({ status: 200, data: envelope([subBanner()]) })
|
|
||||||
}
|
|
||||||
|
|
||||||
vm.showCreateDialog()
|
|
||||||
vm.sub_banner.lang = 'EN'
|
|
||||||
vm.sub_banner.web_url = 'https://example.test/promo'
|
|
||||||
vm.sub_banner.start_date = '2026-11-01T09:30'
|
|
||||||
vm.imageAdd({ name: 'promo.jpg', type: 'image/jpeg' })
|
|
||||||
await vm.submit()
|
|
||||||
|
|
||||||
assert.deepEqual(errors, ['지원하지 않는 언어입니다.'])
|
|
||||||
assert.deepEqual(successes, [])
|
|
||||||
// 400 은 서버가 확실히 거부한 것이므로 재전송을 막지 않고 상태를 보존한다.
|
|
||||||
assert.equal(vm.submit_blocked, false)
|
|
||||||
assert.equal(vm.show_write_dialog, true)
|
|
||||||
assert.equal(vm.sub_banner.lang, 'EN')
|
|
||||||
assert.equal(vm.sub_banner.web_url, 'https://example.test/promo')
|
|
||||||
assert.equal(vm.sub_banner.start_date, '2026-11-01T09:30')
|
|
||||||
assert.equal(vm.sub_banner.image.name, 'promo.jpg')
|
|
||||||
|
|
||||||
const failed = page()
|
|
||||||
Vue.axios = { put: async () => ({ status: 200, data: envelope(null, false, '언어 값이 올바르지 않습니다.') }) }
|
|
||||||
failed.vm.showModifyDialog(subBanner({ id: 9, lang: 'JA', startDate: '2026-11-01 09:30' }))
|
|
||||||
failed.vm.sub_banner.lang = 'EN'
|
|
||||||
await failed.vm.modify()
|
|
||||||
|
|
||||||
assert.deepEqual(failed.errors, ['언어 값이 올바르지 않습니다.'])
|
|
||||||
assert.equal(failed.vm.sub_banner.lang, 'EN')
|
|
||||||
assert.equal(failed.vm.sub_banner.start_date, '2026-11-01T09:30')
|
|
||||||
assert.equal(failed.vm.sub_banner.image_url, 'https://cdn.example.test/promo.jpg')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('목록: 언어를 표시하고 lang 이 없는 응답은 KO 로 간주하지 않는다', async () => {
|
|
||||||
const { vm, errors } = page()
|
|
||||||
Vue.axios = {
|
|
||||||
get: async () => ({
|
|
||||||
status: 200,
|
|
||||||
data: envelope([subBanner({ id: 1, lang: 'KO' }), subBanner({ id: 2, lang: 'JA' }), subBanner({ id: 3, lang: 'EN' })])
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
await vm.getSubBanners()
|
|
||||||
const rendered = activatorText(vm)
|
|
||||||
assert.ok(rendered.includes('한국어'))
|
|
||||||
assert.ok(rendered.includes('일본어'))
|
|
||||||
assert.ok(rendered.includes('영어'))
|
|
||||||
assert.deepEqual(errors, [])
|
|
||||||
|
|
||||||
const missing = subBanner({ id: 4 })
|
|
||||||
delete missing.lang
|
|
||||||
Vue.axios = { get: async () => ({ status: 200, data: envelope([missing]) }) }
|
|
||||||
await vm.getSubBanners()
|
|
||||||
assert.equal(errors.length, 1)
|
|
||||||
assert.equal(vm.langText(missing), '-')
|
|
||||||
})
|
|
||||||
|
|
||||||
;(async () => {
|
;(async () => {
|
||||||
for (const { name, run } of tests) {
|
for (const { name, run } of tests) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user