@spfn/cms 0.1.0-alpha.9 → 0.2.0-beta.1
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/README.md +320 -359
- package/dist/actions.d.ts +12 -6
- package/dist/actions.js +25 -10
- package/dist/actions.js.map +1 -1
- package/dist/config.d.ts +39 -0
- package/dist/config.js +39 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +149 -0
- package/dist/errors.js +164 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +138 -20
- package/dist/index.js +212 -23
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +44 -81
- package/dist/server.js +610 -256
- package/dist/server.js.map +1 -1
- package/migrations/0000_medical_ozymandias.sql +44 -0
- package/migrations/meta/0000_snapshot.json +336 -0
- package/migrations/meta/_journal.json +13 -0
- package/package.json +54 -44
- package/dist/actions.d.ts.map +0 -1
- package/dist/client.d.ts +0 -138
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -62
- package/dist/client.js.map +0 -1
- package/dist/cms.config.d.ts +0 -77
- package/dist/cms.config.d.ts.map +0 -1
- package/dist/cms.config.js +0 -111
- package/dist/cms.config.js.map +0 -1
- package/dist/entities/cms-audit-logs.d.ts +0 -213
- package/dist/entities/cms-audit-logs.d.ts.map +0 -1
- package/dist/entities/cms-audit-logs.js +0 -103
- package/dist/entities/cms-audit-logs.js.map +0 -1
- package/dist/entities/cms-draft-cache.d.ts +0 -188
- package/dist/entities/cms-draft-cache.d.ts.map +0 -1
- package/dist/entities/cms-draft-cache.js +0 -112
- package/dist/entities/cms-draft-cache.js.map +0 -1
- package/dist/entities/cms-label-values.d.ts +0 -192
- package/dist/entities/cms-label-values.d.ts.map +0 -1
- package/dist/entities/cms-label-values.js +0 -105
- package/dist/entities/cms-label-values.js.map +0 -1
- package/dist/entities/cms-label-versions.d.ts +0 -207
- package/dist/entities/cms-label-versions.d.ts.map +0 -1
- package/dist/entities/cms-label-versions.js +0 -80
- package/dist/entities/cms-label-versions.js.map +0 -1
- package/dist/entities/cms-labels.d.ts +0 -189
- package/dist/entities/cms-labels.d.ts.map +0 -1
- package/dist/entities/cms-labels.js +0 -48
- package/dist/entities/cms-labels.js.map +0 -1
- package/dist/entities/cms-published-cache.d.ts +0 -199
- package/dist/entities/cms-published-cache.d.ts.map +0 -1
- package/dist/entities/cms-published-cache.js +0 -103
- package/dist/entities/cms-published-cache.js.map +0 -1
- package/dist/entities/index.d.ts +0 -10
- package/dist/entities/index.d.ts.map +0 -1
- package/dist/entities/index.js +0 -10
- package/dist/entities/index.js.map +0 -1
- package/dist/generators/index.d.ts +0 -19
- package/dist/generators/index.d.ts.map +0 -1
- package/dist/generators/index.js +0 -19
- package/dist/generators/index.js.map +0 -1
- package/dist/generators/label-sync-generator.d.ts +0 -33
- package/dist/generators/label-sync-generator.d.ts.map +0 -1
- package/dist/generators/label-sync-generator.js +0 -86
- package/dist/generators/label-sync-generator.js.map +0 -1
- package/dist/helpers/locale.actions.d.ts +0 -132
- package/dist/helpers/locale.actions.d.ts.map +0 -1
- package/dist/helpers/locale.actions.js +0 -210
- package/dist/helpers/locale.actions.js.map +0 -1
- package/dist/helpers/locale.constants.d.ts +0 -10
- package/dist/helpers/locale.constants.d.ts.map +0 -1
- package/dist/helpers/locale.constants.js +0 -10
- package/dist/helpers/locale.constants.js.map +0 -1
- package/dist/helpers/locale.d.ts +0 -17
- package/dist/helpers/locale.d.ts.map +0 -1
- package/dist/helpers/locale.js +0 -20
- package/dist/helpers/locale.js.map +0 -1
- package/dist/helpers/sync.d.ts +0 -41
- package/dist/helpers/sync.d.ts.map +0 -1
- package/dist/helpers/sync.js +0 -309
- package/dist/helpers/sync.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/init.d.ts +0 -31
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -36
- package/dist/init.js.map +0 -1
- package/dist/labels/helpers.d.ts +0 -31
- package/dist/labels/helpers.d.ts.map +0 -1
- package/dist/labels/helpers.js +0 -60
- package/dist/labels/helpers.js.map +0 -1
- package/dist/labels/index.d.ts +0 -7
- package/dist/labels/index.d.ts.map +0 -1
- package/dist/labels/index.js +0 -7
- package/dist/labels/index.js.map +0 -1
- package/dist/repositories/cms-draft-cache.repository.d.ts +0 -62
- package/dist/repositories/cms-draft-cache.repository.d.ts.map +0 -1
- package/dist/repositories/cms-draft-cache.repository.js +0 -56
- package/dist/repositories/cms-draft-cache.repository.js.map +0 -1
- package/dist/repositories/cms-label-values.repository.d.ts +0 -32
- package/dist/repositories/cms-label-values.repository.d.ts.map +0 -1
- package/dist/repositories/cms-label-values.repository.js +0 -72
- package/dist/repositories/cms-label-values.repository.js.map +0 -1
- package/dist/repositories/cms-labels.repository.d.ts +0 -53
- package/dist/repositories/cms-labels.repository.d.ts.map +0 -1
- package/dist/repositories/cms-labels.repository.js +0 -77
- package/dist/repositories/cms-labels.repository.js.map +0 -1
- package/dist/repositories/cms-published-cache.repository.d.ts +0 -53
- package/dist/repositories/cms-published-cache.repository.d.ts.map +0 -1
- package/dist/repositories/cms-published-cache.repository.js +0 -54
- package/dist/repositories/cms-published-cache.repository.js.map +0 -1
- package/dist/repositories/index.d.ts +0 -8
- package/dist/repositories/index.d.ts.map +0 -1
- package/dist/repositories/index.js +0 -9
- package/dist/repositories/index.js.map +0 -1
- package/dist/routes/labels/[id]/contract.d.ts +0 -68
- package/dist/routes/labels/[id]/contract.d.ts.map +0 -1
- package/dist/routes/labels/[id]/contract.js +0 -84
- package/dist/routes/labels/[id]/contract.js.map +0 -1
- package/dist/routes/labels/[id]/index.d.ts +0 -10
- package/dist/routes/labels/[id]/index.d.ts.map +0 -1
- package/dist/routes/labels/[id]/index.js +0 -96
- package/dist/routes/labels/[id]/index.js.map +0 -1
- package/dist/routes/labels/by-key/[key]/contract.d.ts +0 -24
- package/dist/routes/labels/by-key/[key]/contract.d.ts.map +0 -1
- package/dist/routes/labels/by-key/[key]/contract.js +0 -28
- package/dist/routes/labels/by-key/[key]/contract.js.map +0 -1
- package/dist/routes/labels/by-key/[key]/index.d.ts +0 -8
- package/dist/routes/labels/by-key/[key]/index.d.ts.map +0 -1
- package/dist/routes/labels/by-key/[key]/index.js +0 -32
- package/dist/routes/labels/by-key/[key]/index.js.map +0 -1
- package/dist/routes/labels/contract.d.ts +0 -59
- package/dist/routes/labels/contract.d.ts.map +0 -1
- package/dist/routes/labels/contract.js +0 -75
- package/dist/routes/labels/contract.js.map +0 -1
- package/dist/routes/labels/index.d.ts +0 -10
- package/dist/routes/labels/index.d.ts.map +0 -1
- package/dist/routes/labels/index.js +0 -73
- package/dist/routes/labels/index.js.map +0 -1
- package/dist/routes/published-cache/contract.d.ts +0 -25
- package/dist/routes/published-cache/contract.d.ts.map +0 -1
- package/dist/routes/published-cache/contract.js +0 -35
- package/dist/routes/published-cache/contract.js.map +0 -1
- package/dist/routes/published-cache/index.d.ts +0 -8
- package/dist/routes/published-cache/index.d.ts.map +0 -1
- package/dist/routes/published-cache/index.js +0 -33
- package/dist/routes/published-cache/index.js.map +0 -1
- package/dist/routes/values/[labelId]/[version]/contract.d.ts +0 -29
- package/dist/routes/values/[labelId]/[version]/contract.d.ts.map +0 -1
- package/dist/routes/values/[labelId]/[version]/contract.js +0 -33
- package/dist/routes/values/[labelId]/[version]/contract.js.map +0 -1
- package/dist/routes/values/[labelId]/[version]/index.d.ts +0 -8
- package/dist/routes/values/[labelId]/[version]/index.d.ts.map +0 -1
- package/dist/routes/values/[labelId]/[version]/index.js +0 -45
- package/dist/routes/values/[labelId]/[version]/index.js.map +0 -1
- package/dist/routes/values/[labelId]/contract.d.ts +0 -38
- package/dist/routes/values/[labelId]/contract.d.ts.map +0 -1
- package/dist/routes/values/[labelId]/contract.js +0 -59
- package/dist/routes/values/[labelId]/contract.js.map +0 -1
- package/dist/routes/values/[labelId]/index.d.ts +0 -8
- package/dist/routes/values/[labelId]/index.d.ts.map +0 -1
- package/dist/routes/values/[labelId]/index.js +0 -42
- package/dist/routes/values/[labelId]/index.js.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/store.d.ts +0 -87
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js +0 -205
- package/dist/store.js.map +0 -1
- package/dist/types.d.ts +0 -74
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -7
- package/dist/types.js.map +0 -1
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CMS Label Detail Routes
|
|
3
|
-
*
|
|
4
|
-
* - GET /cms/labels/:id - 라벨 단건 조회
|
|
5
|
-
* - PATCH /cms/labels/:id - 라벨 메타데이터 수정
|
|
6
|
-
* - DELETE /cms/labels/:id - 라벨 삭제
|
|
7
|
-
*/
|
|
8
|
-
import { createApp } from '@spfn/core/route';
|
|
9
|
-
import { Transactional } from '@spfn/core/db';
|
|
10
|
-
import { cmsLabelsRepository } from '../../../repositories/index.js';
|
|
11
|
-
import { getLabelContract, updateLabelContract, deleteLabelContract, } from './contract.js';
|
|
12
|
-
const app = createApp();
|
|
13
|
-
/**
|
|
14
|
-
* GET /cms/labels/:id
|
|
15
|
-
* 라벨 단건 조회
|
|
16
|
-
*/
|
|
17
|
-
app.bind(getLabelContract, async (c) => {
|
|
18
|
-
const { id } = c.params;
|
|
19
|
-
const labelId = parseInt(id, 10);
|
|
20
|
-
if (isNaN(labelId)) {
|
|
21
|
-
return c.json({ error: 'Invalid label ID' }, 400);
|
|
22
|
-
}
|
|
23
|
-
const label = await cmsLabelsRepository.findById(labelId);
|
|
24
|
-
if (!label) {
|
|
25
|
-
return c.json({ error: 'Label not found' }, 404);
|
|
26
|
-
}
|
|
27
|
-
return c.json({
|
|
28
|
-
id: label.id,
|
|
29
|
-
key: label.key,
|
|
30
|
-
section: label.section,
|
|
31
|
-
type: label.type,
|
|
32
|
-
publishedVersion: label.publishedVersion,
|
|
33
|
-
createdBy: label.createdBy,
|
|
34
|
-
createdAt: label.createdAt.toISOString(),
|
|
35
|
-
updatedAt: label.updatedAt.toISOString(),
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
/**
|
|
39
|
-
* PATCH /cms/labels/:id
|
|
40
|
-
* 라벨 메타데이터 수정
|
|
41
|
-
*/
|
|
42
|
-
app.bind(updateLabelContract, [Transactional()], async (c) => {
|
|
43
|
-
const { id } = c.params;
|
|
44
|
-
const labelId = parseInt(id, 10);
|
|
45
|
-
if (isNaN(labelId)) {
|
|
46
|
-
return c.json({ error: 'Invalid label ID' }, 400);
|
|
47
|
-
}
|
|
48
|
-
const body = await c.data();
|
|
49
|
-
// 라벨 존재 확인
|
|
50
|
-
const existing = await cmsLabelsRepository.findById(labelId);
|
|
51
|
-
if (!existing) {
|
|
52
|
-
return c.json({ error: 'Label not found' }, 404);
|
|
53
|
-
}
|
|
54
|
-
// 라벨 수정
|
|
55
|
-
const updated = await cmsLabelsRepository.updateById(labelId, body);
|
|
56
|
-
if (!updated) {
|
|
57
|
-
return c.json({ error: 'Failed to update label' }, 500);
|
|
58
|
-
}
|
|
59
|
-
return c.json({
|
|
60
|
-
id: updated.id,
|
|
61
|
-
key: updated.key,
|
|
62
|
-
section: updated.section,
|
|
63
|
-
type: updated.type,
|
|
64
|
-
publishedVersion: updated.publishedVersion,
|
|
65
|
-
createdBy: updated.createdBy,
|
|
66
|
-
createdAt: updated.createdAt.toISOString(),
|
|
67
|
-
updatedAt: updated.updatedAt.toISOString(),
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
/**
|
|
71
|
-
* DELETE /cms/labels/:id
|
|
72
|
-
* 라벨 삭제
|
|
73
|
-
*/
|
|
74
|
-
app.bind(deleteLabelContract, [Transactional()], async (c) => {
|
|
75
|
-
const { id } = c.params;
|
|
76
|
-
const labelId = parseInt(id, 10);
|
|
77
|
-
if (isNaN(labelId)) {
|
|
78
|
-
return c.json({ error: 'Invalid label ID' }, 400);
|
|
79
|
-
}
|
|
80
|
-
// 라벨 존재 확인
|
|
81
|
-
const existing = await cmsLabelsRepository.findById(labelId);
|
|
82
|
-
if (!existing) {
|
|
83
|
-
return c.json({ error: 'Label not found' }, 404);
|
|
84
|
-
}
|
|
85
|
-
// 라벨 삭제 (CASCADE로 values도 함께 삭제됨)
|
|
86
|
-
const deleted = await cmsLabelsRepository.deleteById(labelId);
|
|
87
|
-
if (!deleted) {
|
|
88
|
-
return c.json({ error: 'Failed to delete label' }, 500);
|
|
89
|
-
}
|
|
90
|
-
return c.json({
|
|
91
|
-
success: true,
|
|
92
|
-
id: deleted.id,
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
export default app;
|
|
96
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/routes/labels/[id]/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACH,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GACtB,MAAM,eAAe,CAAC;AAEvB,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;AAExB;;;GAGG;AACH,GAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAEnC,MAAM,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;IACxB,MAAM,OAAO,GAAG,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAEjC,IAAI,KAAK,CAAC,OAAO,CAAC,EAClB,CAAC;QACG,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,EAAE,GAAG,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;I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EAAE,EAAE,GAAG,CAAC,CAAC;IACrD,CAAC;IAED,kCAAkC;IAClC,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAE9D,IAAI,CAAC,OAAO,EACZ,CAAC;QACG,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,wBAAwB,EAAE,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,CAAC,CAAC,IAAI,CAAC;QACV,OAAO,EAAE,IAAI;QACb,EAAE,EAAE,OAAO,CAAC,EAAE;KACjB,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,eAAe,GAAG,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /cms/labels/by-key/:key - Key로 라벨 조회
|
|
3
|
-
*/
|
|
4
|
-
export declare const getLabelByKeyContract: {
|
|
5
|
-
readonly method: "GET";
|
|
6
|
-
readonly path: "/:key";
|
|
7
|
-
readonly params: import("@sinclair/typebox").TObject<{
|
|
8
|
-
key: import("@sinclair/typebox").TString;
|
|
9
|
-
}>;
|
|
10
|
-
readonly response: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
11
|
-
id: import("@sinclair/typebox").TNumber;
|
|
12
|
-
key: import("@sinclair/typebox").TString;
|
|
13
|
-
section: import("@sinclair/typebox").TString;
|
|
14
|
-
type: import("@sinclair/typebox").TString;
|
|
15
|
-
publishedVersion: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNull]>;
|
|
16
|
-
createdBy: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
17
|
-
createdAt: import("@sinclair/typebox").TString;
|
|
18
|
-
updatedAt: import("@sinclair/typebox").TString;
|
|
19
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
20
|
-
error: import("@sinclair/typebox").TString;
|
|
21
|
-
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
22
|
-
}>]>;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../../src/routes/labels/by-key/[key]/contract.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;CAsBA,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Type } from '@sinclair/typebox';
|
|
2
|
-
/**
|
|
3
|
-
* GET /cms/labels/by-key/:key - Key로 라벨 조회
|
|
4
|
-
*/
|
|
5
|
-
export const getLabelByKeyContract = {
|
|
6
|
-
method: 'GET',
|
|
7
|
-
path: '/:key',
|
|
8
|
-
params: Type.Object({
|
|
9
|
-
key: Type.String({ description: '라벨 Key (예: home.hero.title)' })
|
|
10
|
-
}),
|
|
11
|
-
response: Type.Union([
|
|
12
|
-
Type.Object({
|
|
13
|
-
id: Type.Number(),
|
|
14
|
-
key: Type.String(),
|
|
15
|
-
section: Type.String(),
|
|
16
|
-
type: Type.String(),
|
|
17
|
-
publishedVersion: Type.Union([Type.Number(), Type.Null()]),
|
|
18
|
-
createdBy: Type.Union([Type.String(), Type.Null()]),
|
|
19
|
-
createdAt: Type.String(),
|
|
20
|
-
updatedAt: Type.String()
|
|
21
|
-
}),
|
|
22
|
-
Type.Object({
|
|
23
|
-
error: Type.String(),
|
|
24
|
-
key: Type.Optional(Type.String())
|
|
25
|
-
})
|
|
26
|
-
])
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../../../src/routes/labels/by-key/[key]/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC;;GAEG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By Key Route
|
|
3
|
-
*
|
|
4
|
-
* - GET /cms/labels/by-key/:key - Key로 라벨 조회
|
|
5
|
-
*/
|
|
6
|
-
import { createApp } from '@spfn/core/route';
|
|
7
|
-
import { cmsLabelsRepository } from '../../../../repositories/index.js';
|
|
8
|
-
import { getLabelByKeyContract } from './contract.js';
|
|
9
|
-
const app = createApp();
|
|
10
|
-
/**
|
|
11
|
-
* GET /cms/labels/by-key/:key
|
|
12
|
-
* Key로 라벨 조회
|
|
13
|
-
*/
|
|
14
|
-
app.bind(getLabelByKeyContract, async (c) => {
|
|
15
|
-
const { key } = c.params;
|
|
16
|
-
const label = await cmsLabelsRepository.findByKey(key);
|
|
17
|
-
if (!label) {
|
|
18
|
-
return c.json({ error: 'Label not found', key }, 404);
|
|
19
|
-
}
|
|
20
|
-
return c.json({
|
|
21
|
-
id: label.id,
|
|
22
|
-
key: label.key,
|
|
23
|
-
section: label.section,
|
|
24
|
-
type: label.type,
|
|
25
|
-
publishedVersion: label.publishedVersion,
|
|
26
|
-
createdBy: label.createdBy,
|
|
27
|
-
createdAt: label.createdAt.toISOString(),
|
|
28
|
-
updatedAt: label.updatedAt.toISOString(),
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
export default app;
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/routes/labels/by-key/[key]/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;AAExB;;;GAGG;AACH,GAAG,CAAC,IAAI,CAAC,qBAAqB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAExC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;IAEzB,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAEvD,IAAI,CAAC,KAAK,EACV,CAAC;QACG,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,CAAC,CAAC,IAAI,CAAC;QACV,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE;QACxC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE;KAC3C,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,eAAe,GAAG,CAAC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CMS Labels Contracts
|
|
3
|
-
*
|
|
4
|
-
* 라벨 메타데이터 관리 API
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* GET /cms/labels - 라벨 목록 조회
|
|
8
|
-
*/
|
|
9
|
-
export declare const getLabelsContract: {
|
|
10
|
-
readonly method: "GET";
|
|
11
|
-
readonly path: "/";
|
|
12
|
-
readonly query: import("@sinclair/typebox").TObject<{
|
|
13
|
-
section: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
14
|
-
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
15
|
-
offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
16
|
-
}>;
|
|
17
|
-
readonly response: import("@sinclair/typebox").TObject<{
|
|
18
|
-
labels: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
19
|
-
id: import("@sinclair/typebox").TNumber;
|
|
20
|
-
key: import("@sinclair/typebox").TString;
|
|
21
|
-
section: import("@sinclair/typebox").TString;
|
|
22
|
-
type: import("@sinclair/typebox").TString;
|
|
23
|
-
publishedVersion: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNull]>;
|
|
24
|
-
createdBy: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
25
|
-
createdAt: import("@sinclair/typebox").TString;
|
|
26
|
-
updatedAt: import("@sinclair/typebox").TString;
|
|
27
|
-
}>>;
|
|
28
|
-
total: import("@sinclair/typebox").TNumber;
|
|
29
|
-
limit: import("@sinclair/typebox").TNumber;
|
|
30
|
-
offset: import("@sinclair/typebox").TNumber;
|
|
31
|
-
}>;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* POST /cms/labels - 새 라벨 생성
|
|
35
|
-
*/
|
|
36
|
-
export declare const createLabelContract: {
|
|
37
|
-
readonly method: "POST";
|
|
38
|
-
readonly path: "/";
|
|
39
|
-
readonly body: import("@sinclair/typebox").TObject<{
|
|
40
|
-
key: import("@sinclair/typebox").TString;
|
|
41
|
-
section: import("@sinclair/typebox").TString;
|
|
42
|
-
type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"text">, import("@sinclair/typebox").TLiteral<"image">, import("@sinclair/typebox").TLiteral<"video">, import("@sinclair/typebox").TLiteral<"file">, import("@sinclair/typebox").TLiteral<"object">]>;
|
|
43
|
-
createdBy: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
44
|
-
}>;
|
|
45
|
-
readonly response: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
46
|
-
id: import("@sinclair/typebox").TNumber;
|
|
47
|
-
key: import("@sinclair/typebox").TString;
|
|
48
|
-
section: import("@sinclair/typebox").TString;
|
|
49
|
-
type: import("@sinclair/typebox").TString;
|
|
50
|
-
publishedVersion: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNull]>;
|
|
51
|
-
createdBy: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
52
|
-
createdAt: import("@sinclair/typebox").TString;
|
|
53
|
-
updatedAt: import("@sinclair/typebox").TString;
|
|
54
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
55
|
-
error: import("@sinclair/typebox").TString;
|
|
56
|
-
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
57
|
-
}>]>;
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/routes/labels/contract.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;CAuBI,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;CAqCE,CAAC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Type } from '@sinclair/typebox';
|
|
2
|
-
/**
|
|
3
|
-
* CMS Labels Contracts
|
|
4
|
-
*
|
|
5
|
-
* 라벨 메타데이터 관리 API
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* GET /cms/labels - 라벨 목록 조회
|
|
9
|
-
*/
|
|
10
|
-
export const getLabelsContract = {
|
|
11
|
-
method: 'GET',
|
|
12
|
-
path: '/',
|
|
13
|
-
query: Type.Object({
|
|
14
|
-
section: Type.Optional(Type.String({ description: '섹션으로 필터링 (예: home, why-futureplay)' })),
|
|
15
|
-
limit: Type.Optional(Type.Number({ minimum: 1, maximum: 100, default: 20, description: '페이지당 항목 수' })),
|
|
16
|
-
offset: Type.Optional(Type.Number({ minimum: 0, default: 0, description: '시작 오프셋' }))
|
|
17
|
-
}),
|
|
18
|
-
response: Type.Object({
|
|
19
|
-
labels: Type.Array(Type.Object({
|
|
20
|
-
id: Type.Number(),
|
|
21
|
-
key: Type.String(),
|
|
22
|
-
section: Type.String(),
|
|
23
|
-
type: Type.String(),
|
|
24
|
-
publishedVersion: Type.Union([Type.Number(), Type.Null()]),
|
|
25
|
-
createdBy: Type.Union([Type.String(), Type.Null()]),
|
|
26
|
-
createdAt: Type.String(),
|
|
27
|
-
updatedAt: Type.String()
|
|
28
|
-
})),
|
|
29
|
-
total: Type.Number(),
|
|
30
|
-
limit: Type.Number(),
|
|
31
|
-
offset: Type.Number()
|
|
32
|
-
})
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* POST /cms/labels - 새 라벨 생성
|
|
36
|
-
*/
|
|
37
|
-
export const createLabelContract = {
|
|
38
|
-
method: 'POST',
|
|
39
|
-
path: '/',
|
|
40
|
-
body: Type.Object({
|
|
41
|
-
key: Type.String({
|
|
42
|
-
description: '고유 키 (예: home.hero.title)',
|
|
43
|
-
pattern: '^[a-z0-9-]+\\.[a-z0-9-]+\\.[a-z0-9-]+$'
|
|
44
|
-
}),
|
|
45
|
-
section: Type.String({
|
|
46
|
-
description: '섹션 이름 (예: home, why-futureplay)',
|
|
47
|
-
pattern: '^[a-z0-9-]+$'
|
|
48
|
-
}),
|
|
49
|
-
type: Type.Union([
|
|
50
|
-
Type.Literal('text'),
|
|
51
|
-
Type.Literal('image'),
|
|
52
|
-
Type.Literal('video'),
|
|
53
|
-
Type.Literal('file'),
|
|
54
|
-
Type.Literal('object')
|
|
55
|
-
], { description: '값 타입' }),
|
|
56
|
-
createdBy: Type.Optional(Type.String({ description: '생성자 ID' }))
|
|
57
|
-
}),
|
|
58
|
-
response: Type.Union([
|
|
59
|
-
Type.Object({
|
|
60
|
-
id: Type.Number(),
|
|
61
|
-
key: Type.String(),
|
|
62
|
-
section: Type.String(),
|
|
63
|
-
type: Type.String(),
|
|
64
|
-
publishedVersion: Type.Union([Type.Number(), Type.Null()]),
|
|
65
|
-
createdBy: Type.Union([Type.String(), Type.Null()]),
|
|
66
|
-
createdAt: Type.String(),
|
|
67
|
-
updatedAt: Type.String()
|
|
68
|
-
}),
|
|
69
|
-
Type.Object({
|
|
70
|
-
error: Type.String(),
|
|
71
|
-
key: Type.Optional(Type.String())
|
|
72
|
-
})
|
|
73
|
-
])
|
|
74
|
-
};
|
|
75
|
-
//# sourceMappingURL=contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../src/routes/labels/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC7B,MAAM,EAAE,KAAc;IACtB,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC,CAAC;QAC1F,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;QACtG,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC;KACxF,CAAC;IACF,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,MAAM,EAAE,IAAI,CAAC,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CMS Labels Routes
|
|
3
|
-
*
|
|
4
|
-
* 라벨 메타데이터 관리 API
|
|
5
|
-
* - GET /cms/labels - 라벨 목록 조회
|
|
6
|
-
* - POST /cms/labels - 새 라벨 생성
|
|
7
|
-
*/
|
|
8
|
-
import { createApp } from '@spfn/core/route';
|
|
9
|
-
import { Transactional } from '@spfn/core/db';
|
|
10
|
-
import { cmsLabelsRepository } from '../../repositories/index.js';
|
|
11
|
-
import { getLabelsContract, createLabelContract } from './contract.js';
|
|
12
|
-
const app = createApp();
|
|
13
|
-
/**
|
|
14
|
-
* GET /cms/labels
|
|
15
|
-
* 라벨 목록 조회 (페이지네이션, 섹션 필터)
|
|
16
|
-
*/
|
|
17
|
-
app.bind(getLabelsContract, async (c) => {
|
|
18
|
-
const { section, limit = 20, offset = 0 } = c.query;
|
|
19
|
-
// 라벨 목록 조회
|
|
20
|
-
const labels = await cmsLabelsRepository.findMany({
|
|
21
|
-
section,
|
|
22
|
-
limit,
|
|
23
|
-
offset,
|
|
24
|
-
});
|
|
25
|
-
// 전체 개수 조회
|
|
26
|
-
const total = await cmsLabelsRepository.count(section);
|
|
27
|
-
return c.json({
|
|
28
|
-
labels: labels.map((label) => ({
|
|
29
|
-
id: label.id,
|
|
30
|
-
key: label.key,
|
|
31
|
-
section: label.section,
|
|
32
|
-
type: label.type,
|
|
33
|
-
publishedVersion: label.publishedVersion,
|
|
34
|
-
createdBy: label.createdBy,
|
|
35
|
-
createdAt: label.createdAt.toISOString(),
|
|
36
|
-
updatedAt: label.updatedAt.toISOString(),
|
|
37
|
-
})),
|
|
38
|
-
total,
|
|
39
|
-
limit,
|
|
40
|
-
offset,
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
/**
|
|
44
|
-
* POST /cms/labels
|
|
45
|
-
* 새 라벨 생성
|
|
46
|
-
*/
|
|
47
|
-
app.bind(createLabelContract, [Transactional()], async (c) => {
|
|
48
|
-
const body = await c.data();
|
|
49
|
-
// 중복 key 체크
|
|
50
|
-
const existing = await cmsLabelsRepository.findByKey(body.key);
|
|
51
|
-
if (existing) {
|
|
52
|
-
return c.json({ error: 'Label with this key already exists', key: body.key }, 409);
|
|
53
|
-
}
|
|
54
|
-
// 라벨 생성
|
|
55
|
-
const label = await cmsLabelsRepository.create({
|
|
56
|
-
key: body.key,
|
|
57
|
-
section: body.section,
|
|
58
|
-
type: body.type,
|
|
59
|
-
createdBy: body.createdBy,
|
|
60
|
-
});
|
|
61
|
-
return c.json({
|
|
62
|
-
id: label.id,
|
|
63
|
-
key: label.key,
|
|
64
|
-
section: label.section,
|
|
65
|
-
type: label.type,
|
|
66
|
-
publishedVersion: label.publishedVersion,
|
|
67
|
-
createdBy: label.createdBy,
|
|
68
|
-
createdAt: label.createdAt.toISOString(),
|
|
69
|
-
updatedAt: label.updatedAt.toISOString(),
|
|
70
|
-
}, 201);
|
|
71
|
-
});
|
|
72
|
-
export default app;
|
|
73
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routes/labels/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;AAExB;;;GAGG;AACH,GAAG,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAEpC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,EAAE,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC;IAEpD,WAAW;IACX,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,QAA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GAAG;QACb,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,SAAS,EAAE,IAAI,CAAC,SAAS;KAC5B,CAAC,CAAC;IAEH,OAAO,CAAC,CAAC,IAAI,CACT;QACI,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE;QACxC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE;KAC3C,EACD,GAAG,CACN,CAAC;AACN,CAAC,CAAC,CAAC;AAEH,eAAe,GAAG,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CMS Published Cache API Contract
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* GET /cms/published-cache
|
|
6
|
-
* 발행된 콘텐츠 캐시 조회 (단일 또는 여러 섹션)
|
|
7
|
-
*/
|
|
8
|
-
export declare const getPublishedCacheContract: {
|
|
9
|
-
readonly method: "GET";
|
|
10
|
-
readonly path: "/";
|
|
11
|
-
readonly query: import("@sinclair/typebox").TObject<{
|
|
12
|
-
sections: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>]>;
|
|
13
|
-
locale: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
14
|
-
}>;
|
|
15
|
-
readonly response: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
16
|
-
section: import("@sinclair/typebox").TString;
|
|
17
|
-
locale: import("@sinclair/typebox").TString;
|
|
18
|
-
content: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TAny>;
|
|
19
|
-
version: import("@sinclair/typebox").TNumber;
|
|
20
|
-
publishedAt: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
21
|
-
}>>, import("@sinclair/typebox").TObject<{
|
|
22
|
-
error: import("@sinclair/typebox").TString;
|
|
23
|
-
}>]>;
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/routes/published-cache/contract.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH;;;GAGG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;CAkBJ,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CMS Published Cache API Contract
|
|
3
|
-
*/
|
|
4
|
-
import { Type } from '@sinclair/typebox';
|
|
5
|
-
const SectionData = Type.Object({
|
|
6
|
-
section: Type.String(),
|
|
7
|
-
locale: Type.String(),
|
|
8
|
-
content: Type.Record(Type.String(), Type.Any()),
|
|
9
|
-
version: Type.Number(),
|
|
10
|
-
publishedAt: Type.Union([Type.String(), Type.Null()]),
|
|
11
|
-
});
|
|
12
|
-
/**
|
|
13
|
-
* GET /cms/published-cache
|
|
14
|
-
* 발행된 콘텐츠 캐시 조회 (단일 또는 여러 섹션)
|
|
15
|
-
*/
|
|
16
|
-
export const getPublishedCacheContract = {
|
|
17
|
-
method: 'GET',
|
|
18
|
-
path: '/',
|
|
19
|
-
query: Type.Object({
|
|
20
|
-
sections: Type.Union([
|
|
21
|
-
Type.String({ description: '단일 섹션 이름 (예: home)' }),
|
|
22
|
-
Type.Array(Type.String(), { description: '여러 섹션 이름 (예: ["home", "footer"])' })
|
|
23
|
-
]),
|
|
24
|
-
locale: Type.Optional(Type.String({ default: 'ko', description: '언어 코드' })),
|
|
25
|
-
}),
|
|
26
|
-
response: Type.Union([
|
|
27
|
-
// 성공: 항상 배열로 반환
|
|
28
|
-
Type.Array(SectionData),
|
|
29
|
-
// 에러
|
|
30
|
-
Type.Object({
|
|
31
|
-
error: Type.String()
|
|
32
|
-
})
|
|
33
|
-
])
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../src/routes/published-cache/contract.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5B,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE;IACtB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;IAC/C,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE;IACtB,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;CACxD,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACrC,MAAM,EAAE,KAAc;IACtB,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;QACf,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC;YACjB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;YAClD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;SACjF,CAAC;QACF,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;KAC9E,CAAC;IACF,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC;QACjB,gBAAgB;QAChB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QACvB,KAAK;QACL,IAAI,CAAC,MAAM,CAAC;YACR,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;SACvB,CAAC;KACL,CAAC;CAC4B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/published-cache/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,QAAA,MAAM,GAAG,oCAAc,CAAC;AAgCxB,eAAe,GAAG,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CMS Published Cache Routes
|
|
3
|
-
*
|
|
4
|
-
* - GET /cms/published-cache - 발행된 콘텐츠 캐시 조회 (단일 또는 배치)
|
|
5
|
-
*/
|
|
6
|
-
import { createApp } from '@spfn/core/route';
|
|
7
|
-
import { cmsPublishedCacheRepository } from '../../repositories/index.js';
|
|
8
|
-
import { getPublishedCacheContract } from './contract.js';
|
|
9
|
-
const app = createApp();
|
|
10
|
-
/**
|
|
11
|
-
* GET /cms/published-cache
|
|
12
|
-
* 발행된 섹션 콘텐츠 조회 (단일 또는 여러 섹션)
|
|
13
|
-
*/
|
|
14
|
-
app.bind(getPublishedCacheContract, async (c) => {
|
|
15
|
-
const { sections: sectionsParam, locale = 'ko' } = c.query;
|
|
16
|
-
// Normalize to array
|
|
17
|
-
const sections = Array.isArray(sectionsParam) ? sectionsParam : [sectionsParam];
|
|
18
|
-
// Fetch all sections in parallel
|
|
19
|
-
const results = await Promise.all(sections.map(section => cmsPublishedCacheRepository.findBySection(section, locale)));
|
|
20
|
-
// Map to response format (only include found sections)
|
|
21
|
-
const found = results
|
|
22
|
-
.filter((cache) => cache !== null)
|
|
23
|
-
.map(cache => ({
|
|
24
|
-
section: cache.section,
|
|
25
|
-
locale: cache.locale,
|
|
26
|
-
content: cache.content,
|
|
27
|
-
version: cache.version,
|
|
28
|
-
publishedAt: cache.publishedAt?.toISOString() || null,
|
|
29
|
-
}));
|
|
30
|
-
return c.json(found);
|
|
31
|
-
});
|
|
32
|
-
export default app;
|
|
33
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routes/published-cache/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;AAExB;;;GAGG;AACH,GAAG,CAAC,IAAI,CAAC,yBAAyB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAE5C,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC;IAE3D,qBAAqB;IACrB,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAEhF,iCAAiC;IACjC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC7B,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,2BAA2B,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CACtF,CAAC;IAEF,uDAAuD;IACvD,MAAM,KAAK,GAAG,OAAO;SAChB,MAAM,CAAC,CAAC,KAAK,EAAsC,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC;SACrE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACX,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,KAAK,CAAC,OAA8B;QAC7C,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,IAAI;KACxD,CAAC,CAAC,CAAC;IAER,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,eAAe,GAAG,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GET /cms/values/:labelId/:version - 특정 버전의 값 조회
|
|
3
|
-
*/
|
|
4
|
-
export declare const getValuesContract: {
|
|
5
|
-
readonly method: "GET";
|
|
6
|
-
readonly path: "/:labelId/:version";
|
|
7
|
-
readonly params: import("@sinclair/typebox").TObject<{
|
|
8
|
-
labelId: import("@sinclair/typebox").TString;
|
|
9
|
-
version: import("@sinclair/typebox").TString;
|
|
10
|
-
}>;
|
|
11
|
-
readonly query: import("@sinclair/typebox").TObject<{
|
|
12
|
-
locale: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
13
|
-
breakpoint: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
14
|
-
}>;
|
|
15
|
-
readonly response: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
16
|
-
labelId: import("@sinclair/typebox").TNumber;
|
|
17
|
-
version: import("@sinclair/typebox").TNumber;
|
|
18
|
-
values: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
19
|
-
id: import("@sinclair/typebox").TNumber;
|
|
20
|
-
locale: import("@sinclair/typebox").TString;
|
|
21
|
-
breakpoint: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
22
|
-
value: import("@sinclair/typebox").TAny;
|
|
23
|
-
createdAt: import("@sinclair/typebox").TString;
|
|
24
|
-
}>>;
|
|
25
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
26
|
-
error: import("@sinclair/typebox").TString;
|
|
27
|
-
}>]>;
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../../src/routes/values/[labelId]/[version]/contract.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;CA6BI,CAAC"}
|