@spfn/cms 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +490 -0
- package/dist/actions.d.ts +9 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +11 -0
- package/dist/actions.js.map +1 -0
- package/dist/client.d.ts +138 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +62 -0
- package/dist/client.js.map +1 -0
- package/dist/cms.config.d.ts +77 -0
- package/dist/cms.config.d.ts.map +1 -0
- package/dist/cms.config.js +111 -0
- package/dist/cms.config.js.map +1 -0
- package/dist/entities/cms-audit-logs.d.ts +213 -0
- package/dist/entities/cms-audit-logs.d.ts.map +1 -0
- package/dist/entities/cms-audit-logs.js +103 -0
- package/dist/entities/cms-audit-logs.js.map +1 -0
- package/dist/entities/cms-draft-cache.d.ts +188 -0
- package/dist/entities/cms-draft-cache.d.ts.map +1 -0
- package/dist/entities/cms-draft-cache.js +112 -0
- package/dist/entities/cms-draft-cache.js.map +1 -0
- package/dist/entities/cms-label-values.d.ts +192 -0
- package/dist/entities/cms-label-values.d.ts.map +1 -0
- package/dist/entities/cms-label-values.js +105 -0
- package/dist/entities/cms-label-values.js.map +1 -0
- package/dist/entities/cms-label-versions.d.ts +207 -0
- package/dist/entities/cms-label-versions.d.ts.map +1 -0
- package/dist/entities/cms-label-versions.js +80 -0
- package/dist/entities/cms-label-versions.js.map +1 -0
- package/dist/entities/cms-labels.d.ts +189 -0
- package/dist/entities/cms-labels.d.ts.map +1 -0
- package/dist/entities/cms-labels.js +48 -0
- package/dist/entities/cms-labels.js.map +1 -0
- package/dist/entities/cms-published-cache.d.ts +199 -0
- package/dist/entities/cms-published-cache.d.ts.map +1 -0
- package/dist/entities/cms-published-cache.js +103 -0
- package/dist/entities/cms-published-cache.js.map +1 -0
- package/dist/entities/index.d.ts +10 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +10 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/generators/index.d.ts +19 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +19 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/label-sync-generator.d.ts +33 -0
- package/dist/generators/label-sync-generator.d.ts.map +1 -0
- package/dist/generators/label-sync-generator.js +86 -0
- package/dist/generators/label-sync-generator.js.map +1 -0
- package/dist/helpers/locale.actions.d.ts +132 -0
- package/dist/helpers/locale.actions.d.ts.map +1 -0
- package/dist/helpers/locale.actions.js +210 -0
- package/dist/helpers/locale.actions.js.map +1 -0
- package/dist/helpers/locale.constants.d.ts +10 -0
- package/dist/helpers/locale.constants.d.ts.map +1 -0
- package/dist/helpers/locale.constants.js +10 -0
- package/dist/helpers/locale.constants.js.map +1 -0
- package/dist/helpers/locale.d.ts +17 -0
- package/dist/helpers/locale.d.ts.map +1 -0
- package/dist/helpers/locale.js +20 -0
- package/dist/helpers/locale.js.map +1 -0
- package/dist/helpers/sync.d.ts +41 -0
- package/dist/helpers/sync.d.ts.map +1 -0
- package/dist/helpers/sync.js +309 -0
- package/dist/helpers/sync.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +31 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +36 -0
- package/dist/init.js.map +1 -0
- package/dist/labels/helpers.d.ts +31 -0
- package/dist/labels/helpers.d.ts.map +1 -0
- package/dist/labels/helpers.js +60 -0
- package/dist/labels/helpers.js.map +1 -0
- package/dist/labels/index.d.ts +7 -0
- package/dist/labels/index.d.ts.map +1 -0
- package/dist/labels/index.js +7 -0
- package/dist/labels/index.js.map +1 -0
- package/dist/repositories/cms-draft-cache.repository.d.ts +62 -0
- package/dist/repositories/cms-draft-cache.repository.d.ts.map +1 -0
- package/dist/repositories/cms-draft-cache.repository.js +56 -0
- package/dist/repositories/cms-draft-cache.repository.js.map +1 -0
- package/dist/repositories/cms-label-values.repository.d.ts +32 -0
- package/dist/repositories/cms-label-values.repository.d.ts.map +1 -0
- package/dist/repositories/cms-label-values.repository.js +72 -0
- package/dist/repositories/cms-label-values.repository.js.map +1 -0
- package/dist/repositories/cms-labels.repository.d.ts +53 -0
- package/dist/repositories/cms-labels.repository.d.ts.map +1 -0
- package/dist/repositories/cms-labels.repository.js +77 -0
- package/dist/repositories/cms-labels.repository.js.map +1 -0
- package/dist/repositories/cms-published-cache.repository.d.ts +53 -0
- package/dist/repositories/cms-published-cache.repository.d.ts.map +1 -0
- package/dist/repositories/cms-published-cache.repository.js +54 -0
- package/dist/repositories/cms-published-cache.repository.js.map +1 -0
- package/dist/repositories/index.d.ts +8 -0
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +9 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/routes/labels/[id]/contract.d.ts +68 -0
- package/dist/routes/labels/[id]/contract.d.ts.map +1 -0
- package/dist/routes/labels/[id]/contract.js +84 -0
- package/dist/routes/labels/[id]/contract.js.map +1 -0
- package/dist/routes/labels/[id]/index.d.ts +10 -0
- package/dist/routes/labels/[id]/index.d.ts.map +1 -0
- package/dist/routes/labels/[id]/index.js +96 -0
- package/dist/routes/labels/[id]/index.js.map +1 -0
- package/dist/routes/labels/by-key/[key]/contract.d.ts +24 -0
- package/dist/routes/labels/by-key/[key]/contract.d.ts.map +1 -0
- package/dist/routes/labels/by-key/[key]/contract.js +28 -0
- package/dist/routes/labels/by-key/[key]/contract.js.map +1 -0
- package/dist/routes/labels/by-key/[key]/index.d.ts +8 -0
- package/dist/routes/labels/by-key/[key]/index.d.ts.map +1 -0
- package/dist/routes/labels/by-key/[key]/index.js +32 -0
- package/dist/routes/labels/by-key/[key]/index.js.map +1 -0
- package/dist/routes/labels/contract.d.ts +59 -0
- package/dist/routes/labels/contract.d.ts.map +1 -0
- package/dist/routes/labels/contract.js +75 -0
- package/dist/routes/labels/contract.js.map +1 -0
- package/dist/routes/labels/index.d.ts +10 -0
- package/dist/routes/labels/index.d.ts.map +1 -0
- package/dist/routes/labels/index.js +73 -0
- package/dist/routes/labels/index.js.map +1 -0
- package/dist/routes/published-cache/contract.d.ts +25 -0
- package/dist/routes/published-cache/contract.d.ts.map +1 -0
- package/dist/routes/published-cache/contract.js +35 -0
- package/dist/routes/published-cache/contract.js.map +1 -0
- package/dist/routes/published-cache/index.d.ts +8 -0
- package/dist/routes/published-cache/index.d.ts.map +1 -0
- package/dist/routes/published-cache/index.js +33 -0
- package/dist/routes/published-cache/index.js.map +1 -0
- package/dist/routes/sync/contract.d.ts +33 -0
- package/dist/routes/sync/contract.d.ts.map +1 -0
- package/dist/routes/sync/contract.js +34 -0
- package/dist/routes/sync/contract.js.map +1 -0
- package/dist/routes/sync/index.d.ts +13 -0
- package/dist/routes/sync/index.d.ts.map +1 -0
- package/dist/routes/sync/index.js +241 -0
- package/dist/routes/sync/index.js.map +1 -0
- package/dist/routes/values/[labelId]/[version]/contract.d.ts +29 -0
- package/dist/routes/values/[labelId]/[version]/contract.d.ts.map +1 -0
- package/dist/routes/values/[labelId]/[version]/contract.js +33 -0
- package/dist/routes/values/[labelId]/[version]/contract.js.map +1 -0
- package/dist/routes/values/[labelId]/[version]/index.d.ts +8 -0
- package/dist/routes/values/[labelId]/[version]/index.d.ts.map +1 -0
- package/dist/routes/values/[labelId]/[version]/index.js +45 -0
- package/dist/routes/values/[labelId]/[version]/index.js.map +1 -0
- package/dist/routes/values/[labelId]/contract.d.ts +38 -0
- package/dist/routes/values/[labelId]/contract.d.ts.map +1 -0
- package/dist/routes/values/[labelId]/contract.js +59 -0
- package/dist/routes/values/[labelId]/contract.js.map +1 -0
- package/dist/routes/values/[labelId]/index.d.ts +8 -0
- package/dist/routes/values/[labelId]/index.d.ts.map +1 -0
- package/dist/routes/values/[labelId]/index.js +42 -0
- package/dist/routes/values/[labelId]/index.js.map +1 -0
- package/dist/server.d.ts +99 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +256 -0
- package/dist/server.js.map +1 -0
- package/dist/store.d.ts +87 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +205 -0
- package/dist/store.js.map +1 -0
- package/dist/sync.d.ts +11 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +179 -0
- package/dist/sync.js.map +1 -0
- package/dist/types.d.ts +74 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CMS Published Cache Repository
|
|
3
|
+
*
|
|
4
|
+
* 발행된 콘텐츠 캐시 관리 (초고속 조회)
|
|
5
|
+
*/
|
|
6
|
+
import { type NewCmsPublishedCache } from '../entities';
|
|
7
|
+
/**
|
|
8
|
+
* 섹션 + 언어로 발행된 캐시 조회
|
|
9
|
+
*/
|
|
10
|
+
export declare function findBySection(section: string, locale?: string): Promise<{
|
|
11
|
+
section: string;
|
|
12
|
+
id: number;
|
|
13
|
+
locale: string;
|
|
14
|
+
content: unknown;
|
|
15
|
+
version: number;
|
|
16
|
+
publishedAt: Date;
|
|
17
|
+
publishedBy: string | null;
|
|
18
|
+
} | null>;
|
|
19
|
+
/**
|
|
20
|
+
* 캐시 생성 또는 업데이트 (UPSERT)
|
|
21
|
+
*/
|
|
22
|
+
export declare function upsert(data: NewCmsPublishedCache): Promise<{
|
|
23
|
+
section: string;
|
|
24
|
+
id: number;
|
|
25
|
+
locale: string;
|
|
26
|
+
content: unknown;
|
|
27
|
+
version: number;
|
|
28
|
+
publishedAt: Date;
|
|
29
|
+
publishedBy: string | null;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* 섹션별 모든 언어 캐시 조회
|
|
33
|
+
*/
|
|
34
|
+
export declare function findAllLanguages(section: string): Promise<{
|
|
35
|
+
section: string;
|
|
36
|
+
id: number;
|
|
37
|
+
locale: string;
|
|
38
|
+
content: unknown;
|
|
39
|
+
version: number;
|
|
40
|
+
publishedAt: Date;
|
|
41
|
+
publishedBy: string | null;
|
|
42
|
+
}[]>;
|
|
43
|
+
/**
|
|
44
|
+
* 캐시 삭제
|
|
45
|
+
*/
|
|
46
|
+
export declare function deleteBySection(section: string, locale?: string): Promise<void>;
|
|
47
|
+
export declare const cmsPublishedCacheRepository: {
|
|
48
|
+
findBySection: typeof findBySection;
|
|
49
|
+
upsert: typeof upsert;
|
|
50
|
+
findAllLanguages: typeof findAllLanguages;
|
|
51
|
+
deleteBySection: typeof deleteBySection;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=cms-published-cache.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cms-published-cache.repository.d.ts","sourceRoot":"","sources":["../../src/repositories/cms-published-cache.repository.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAqB,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE3E;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAa;;;;;;;;UASzE;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,oBAAoB;;;;;;;;GAWtD;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM;;;;;;;;KAKrD;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,iBAmBrE;AAED,eAAO,MAAM,2BAA2B;;;;;CAKvC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CMS Published Cache Repository
|
|
3
|
+
*
|
|
4
|
+
* 발행된 콘텐츠 캐시 관리 (초고속 조회)
|
|
5
|
+
*/
|
|
6
|
+
import { findOne, findMany, deleteOne, deleteMany, upsert as upsertHelper } from '@spfn/core/db';
|
|
7
|
+
import { eq, and, sql } from 'drizzle-orm';
|
|
8
|
+
import { cmsPublishedCache } from '../entities';
|
|
9
|
+
/**
|
|
10
|
+
* 섹션 + 언어로 발행된 캐시 조회
|
|
11
|
+
*/
|
|
12
|
+
export async function findBySection(section, locale = 'ko') {
|
|
13
|
+
return findOne(cmsPublishedCache, and(eq(cmsPublishedCache.section, section), eq(cmsPublishedCache.locale, locale)));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 캐시 생성 또는 업데이트 (UPSERT)
|
|
17
|
+
*/
|
|
18
|
+
export async function upsert(data) {
|
|
19
|
+
return upsertHelper(cmsPublishedCache, data, {
|
|
20
|
+
target: [cmsPublishedCache.section, cmsPublishedCache.locale],
|
|
21
|
+
set: {
|
|
22
|
+
content: data.content,
|
|
23
|
+
publishedAt: data.publishedAt,
|
|
24
|
+
publishedBy: data.publishedBy,
|
|
25
|
+
version: sql `${cmsPublishedCache.version} + 1`, // 버전 증가로 클라이언트 캐시 무효화
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 섹션별 모든 언어 캐시 조회
|
|
31
|
+
*/
|
|
32
|
+
export async function findAllLanguages(section) {
|
|
33
|
+
return findMany(cmsPublishedCache, {
|
|
34
|
+
where: eq(cmsPublishedCache.section, section)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 캐시 삭제
|
|
39
|
+
*/
|
|
40
|
+
export async function deleteBySection(section, locale) {
|
|
41
|
+
if (locale) {
|
|
42
|
+
await deleteOne(cmsPublishedCache, and(eq(cmsPublishedCache.section, section), eq(cmsPublishedCache.locale, locale)));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
await deleteMany(cmsPublishedCache, eq(cmsPublishedCache.section, section));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export const cmsPublishedCacheRepository = {
|
|
49
|
+
findBySection,
|
|
50
|
+
upsert,
|
|
51
|
+
findAllLanguages,
|
|
52
|
+
deleteBySection,
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=cms-published-cache.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cms-published-cache.repository.js","sourceRoot":"","sources":["../../src/repositories/cms-published-cache.repository.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAA6B,MAAM,aAAa,CAAC;AAE3E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAe,EAAE,SAAiB,IAAI;IAEtE,OAAO,OAAO,CACV,iBAAiB,EACjB,GAAG,CACC,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,EACtC,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CACvC,CACJ,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAA0B;IAEnD,OAAO,YAAY,CAAC,iBAAiB,EAAE,IAAI,EAAE;QACzC,MAAM,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC;QAC7D,GAAG,EAAE;YACD,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,GAAG,CAAA,GAAG,iBAAiB,CAAC,OAAO,MAAM,EAAE,sBAAsB;SACzE;KACJ,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAe;IAElD,OAAO,QAAQ,CAAC,iBAAiB,EAAE;QAC/B,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC;KAChD,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAe,EAAE,MAAe;IAElE,IAAI,MAAM,EACV,CAAC;QACG,MAAM,SAAS,CACX,iBAAiB,EACjB,GAAG,CACC,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,EACtC,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CACvC,CACJ,CAAC;IACN,CAAC;SAED,CAAC;QACG,MAAM,UAAU,CACZ,iBAAiB,EACjB,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CACzC,CAAC;IACN,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACvC,aAAa;IACb,MAAM;IACN,gBAAgB;IAChB,eAAe;CAClB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CMS Database Repositories
|
|
3
|
+
*/
|
|
4
|
+
export { cmsLabelsRepository } from './cms-labels.repository';
|
|
5
|
+
export { cmsLabelValuesRepository } from './cms-label-values.repository';
|
|
6
|
+
export { cmsDraftCacheRepository } from './cms-draft-cache.repository';
|
|
7
|
+
export { cmsPublishedCacheRepository } from './cms-published-cache.repository';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CMS Database Repositories
|
|
3
|
+
*/
|
|
4
|
+
// Export repositories as namespaced objects to avoid naming conflicts
|
|
5
|
+
export { cmsLabelsRepository } from './cms-labels.repository';
|
|
6
|
+
export { cmsLabelValuesRepository } from './cms-label-values.repository';
|
|
7
|
+
export { cmsDraftCacheRepository } from './cms-draft-cache.repository';
|
|
8
|
+
export { cmsPublishedCacheRepository } from './cms-published-cache.repository';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,sEAAsE;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CMS Label Detail Contracts
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* GET /cms/labels/:id - 라벨 단건 조회
|
|
6
|
+
*/
|
|
7
|
+
export declare const getLabelContract: {
|
|
8
|
+
readonly method: "GET";
|
|
9
|
+
readonly path: "/:id";
|
|
10
|
+
readonly params: import("@sinclair/typebox").TObject<{
|
|
11
|
+
id: import("@sinclair/typebox").TString;
|
|
12
|
+
}>;
|
|
13
|
+
readonly response: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
14
|
+
id: import("@sinclair/typebox").TNumber;
|
|
15
|
+
key: import("@sinclair/typebox").TString;
|
|
16
|
+
section: import("@sinclair/typebox").TString;
|
|
17
|
+
type: import("@sinclair/typebox").TString;
|
|
18
|
+
publishedVersion: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNull]>;
|
|
19
|
+
createdBy: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
20
|
+
createdAt: import("@sinclair/typebox").TString;
|
|
21
|
+
updatedAt: import("@sinclair/typebox").TString;
|
|
22
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
23
|
+
error: import("@sinclair/typebox").TString;
|
|
24
|
+
}>]>;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* PATCH /cms/labels/:id - 라벨 메타데이터 수정
|
|
28
|
+
*/
|
|
29
|
+
export declare const updateLabelContract: {
|
|
30
|
+
readonly method: "PATCH";
|
|
31
|
+
readonly path: "/:id";
|
|
32
|
+
readonly params: import("@sinclair/typebox").TObject<{
|
|
33
|
+
id: import("@sinclair/typebox").TString;
|
|
34
|
+
}>;
|
|
35
|
+
readonly body: import("@sinclair/typebox").TObject<{
|
|
36
|
+
section: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
37
|
+
type: import("@sinclair/typebox").TOptional<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">]>>;
|
|
38
|
+
}>;
|
|
39
|
+
readonly response: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
40
|
+
id: import("@sinclair/typebox").TNumber;
|
|
41
|
+
key: import("@sinclair/typebox").TString;
|
|
42
|
+
section: import("@sinclair/typebox").TString;
|
|
43
|
+
type: import("@sinclair/typebox").TString;
|
|
44
|
+
publishedVersion: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNull]>;
|
|
45
|
+
createdBy: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
46
|
+
createdAt: import("@sinclair/typebox").TString;
|
|
47
|
+
updatedAt: import("@sinclair/typebox").TString;
|
|
48
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
49
|
+
error: import("@sinclair/typebox").TString;
|
|
50
|
+
}>]>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* DELETE /cms/labels/:id - 라벨 삭제
|
|
54
|
+
*/
|
|
55
|
+
export declare const deleteLabelContract: {
|
|
56
|
+
readonly method: "DELETE";
|
|
57
|
+
readonly path: "/:id";
|
|
58
|
+
readonly params: import("@sinclair/typebox").TObject<{
|
|
59
|
+
id: import("@sinclair/typebox").TString;
|
|
60
|
+
}>;
|
|
61
|
+
readonly response: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
62
|
+
success: import("@sinclair/typebox").TBoolean;
|
|
63
|
+
id: import("@sinclair/typebox").TNumber;
|
|
64
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
65
|
+
error: import("@sinclair/typebox").TString;
|
|
66
|
+
}>]>;
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/routes/labels/[id]/contract.ts"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;CAqBK,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;CA+BE,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;CAeE,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
/**
|
|
3
|
+
* CMS Label Detail Contracts
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* GET /cms/labels/:id - 라벨 단건 조회
|
|
7
|
+
*/
|
|
8
|
+
export const getLabelContract = {
|
|
9
|
+
method: 'GET',
|
|
10
|
+
path: '/:id',
|
|
11
|
+
params: Type.Object({
|
|
12
|
+
id: Type.String({ description: '라벨 ID' })
|
|
13
|
+
}),
|
|
14
|
+
response: Type.Union([
|
|
15
|
+
Type.Object({
|
|
16
|
+
id: Type.Number(),
|
|
17
|
+
key: Type.String(),
|
|
18
|
+
section: Type.String(),
|
|
19
|
+
type: Type.String(),
|
|
20
|
+
publishedVersion: Type.Union([Type.Number(), Type.Null()]),
|
|
21
|
+
createdBy: Type.Union([Type.String(), Type.Null()]),
|
|
22
|
+
createdAt: Type.String(),
|
|
23
|
+
updatedAt: Type.String()
|
|
24
|
+
}),
|
|
25
|
+
Type.Object({
|
|
26
|
+
error: Type.String()
|
|
27
|
+
})
|
|
28
|
+
])
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* PATCH /cms/labels/:id - 라벨 메타데이터 수정
|
|
32
|
+
*/
|
|
33
|
+
export const updateLabelContract = {
|
|
34
|
+
method: 'PATCH',
|
|
35
|
+
path: '/:id',
|
|
36
|
+
params: Type.Object({
|
|
37
|
+
id: Type.String({ description: '라벨 ID' })
|
|
38
|
+
}),
|
|
39
|
+
body: Type.Object({
|
|
40
|
+
section: Type.Optional(Type.String({ description: '섹션 변경' })),
|
|
41
|
+
type: Type.Optional(Type.Union([
|
|
42
|
+
Type.Literal('text'),
|
|
43
|
+
Type.Literal('image'),
|
|
44
|
+
Type.Literal('video'),
|
|
45
|
+
Type.Literal('file'),
|
|
46
|
+
Type.Literal('object')
|
|
47
|
+
]))
|
|
48
|
+
}),
|
|
49
|
+
response: Type.Union([
|
|
50
|
+
Type.Object({
|
|
51
|
+
id: Type.Number(),
|
|
52
|
+
key: Type.String(),
|
|
53
|
+
section: Type.String(),
|
|
54
|
+
type: Type.String(),
|
|
55
|
+
publishedVersion: Type.Union([Type.Number(), Type.Null()]),
|
|
56
|
+
createdBy: Type.Union([Type.String(), Type.Null()]),
|
|
57
|
+
createdAt: Type.String(),
|
|
58
|
+
updatedAt: Type.String()
|
|
59
|
+
}),
|
|
60
|
+
Type.Object({
|
|
61
|
+
error: Type.String()
|
|
62
|
+
})
|
|
63
|
+
])
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* DELETE /cms/labels/:id - 라벨 삭제
|
|
67
|
+
*/
|
|
68
|
+
export const deleteLabelContract = {
|
|
69
|
+
method: 'DELETE',
|
|
70
|
+
path: '/:id',
|
|
71
|
+
params: Type.Object({
|
|
72
|
+
id: Type.String({ description: '라벨 ID' })
|
|
73
|
+
}),
|
|
74
|
+
response: Type.Union([
|
|
75
|
+
Type.Object({
|
|
76
|
+
success: Type.Boolean(),
|
|
77
|
+
id: Type.Number()
|
|
78
|
+
}),
|
|
79
|
+
Type.Object({
|
|
80
|
+
error: Type.String()
|
|
81
|
+
})
|
|
82
|
+
])
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../../src/routes/labels/[id]/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,MAAM,EAAE,KAAc;IACtB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;QAChB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;KAC5C,CAAC;IACF,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC;QACjB,IAAI,CAAC,MAAM,CAAC;YACR,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;YACjB,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE;YAClB,OA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
|
3
|
+
*
|
|
4
|
+
* - GET /cms/labels/:id - 라벨 단건 조회
|
|
5
|
+
* - PATCH /cms/labels/:id - 라벨 메타데이터 수정
|
|
6
|
+
* - DELETE /cms/labels/:id - 라벨 삭제
|
|
7
|
+
*/
|
|
8
|
+
declare const app: import("@spfn/core/route").SPFNApp;
|
|
9
|
+
export default app;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/routes/labels/[id]/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,QAAA,MAAM,GAAG,oCAAc,CAAC;AAiHxB,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
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';
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,uBAAuB,CAAC;AAC5D,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,CA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AkB,EAAE,EAAE,GAAG,CAAC,CAAC;IACtD,CAAC;IAED,WAAW;IACX,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC7D,IAAI,CAAC,QAAQ,EACb,CAAC;QACG,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,iBAAiB,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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,MAAM,EAAE,KAAc;IACtB,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;QAChB,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;KACnE,CAAC;IACF,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC;QACjB,IAAI,CAAC,MAAM,CAAC;YACR,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;YACjB,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE;YAClB,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE;YACtB,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;YACnB,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YAC1D,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACnD,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE;YACxB,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE;SAC3B,CAAC;QACF,IAAI,CAAC,MAAM,CAAC;YACR,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;YACpB,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;SACpC,CAAC;KACL,CAAC;CAC4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/routes/labels/by-key/[key]/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,QAAA,MAAM,GAAG,oCAAc,CAAC;AA6BxB,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CMS Label 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';
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,0BAA0B,CAAC;AAC/D,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"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|