@blockspoon/cert-badge-renderer 1.0.2 → 1.0.4
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 +4 -4
- package/dist/interface/index.d.ts +1 -3
- package/dist/templates/badges/BadgeType1.js +21 -3
- package/dist/templates/badges/BadgeType15.js +13 -12
- package/dist/templates/badges/BadgeType21.js +41 -39
- package/dist/templates/badges/BadgeType35.js +7 -13
- package/dist/templates/badges/BadgeType63.d.ts +1 -1
- package/dist/templates/badges/BadgeType63.js +33 -42
- package/dist/templates/badges/BadgeType7.js +37 -16
- package/dist/templates/svgTemplate.js +8 -83
- package/dist/utils/generateAchievementFile.d.ts +1 -1
- package/dist/utils/generateAchievementHTML.d.ts +1 -1
- package/dist/utils/generateAchievementHTML.js +11 -47
- package/dist/utils/generateDesignFile.d.ts +1 -1
- package/dist/utils/getBindingValue.js +7 -8
- package/package.json +1 -1
- package/src/interface/index.ts +1 -3
- package/src/templates/badges/BadgeType1.ts +22 -4
- package/src/templates/badges/BadgeType15.ts +13 -12
- package/src/templates/badges/BadgeType21.ts +41 -39
- package/src/templates/badges/BadgeType35.ts +7 -13
- package/src/templates/badges/BadgeType63.ts +37 -43
- package/src/templates/badges/BadgeType7.ts +38 -17
- package/src/templates/svgTemplate.ts +8 -102
- package/src/utils/generateAchievementHTML.ts +11 -53
- package/src/utils/getBindingValue.ts +13 -15
- package/test/certificate.html +294 -236
- package/test/certificate.png +0 -0
- package/test/certificate_base64.png +0 -0
- package/test/test.js +203 -554
package/test/test.js
CHANGED
|
@@ -13,514 +13,173 @@ const { generateDesignFile } = require("../dist/utils/generateDesignFile");
|
|
|
13
13
|
const test_object = {
|
|
14
14
|
statusCode: 200,
|
|
15
15
|
message: "인증서 양식이 조회되었습니다.",
|
|
16
|
-
|
|
17
|
-
id:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
representativeInstitution: null,
|
|
36
|
-
requirements: [
|
|
37
|
-
{
|
|
38
|
-
type: "read",
|
|
39
|
-
url: "https://landing.kolleges.net/",
|
|
40
|
-
description: "kolleges landing",
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: "submit_homework",
|
|
44
|
-
url: "https://admin.kolleges.net/ko/onboard/sign_in",
|
|
45
|
-
description: "kolleges main",
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
achievementCertificateDesign: {
|
|
49
|
-
id: 165,
|
|
50
|
-
name: "sandbox-certificate-v1",
|
|
51
|
-
main_color: "#7657FA",
|
|
52
|
-
sub_color: "#CABDFF",
|
|
53
|
-
extra_color_1: null,
|
|
54
|
-
extra_color_2: null,
|
|
55
|
-
layout_json: [
|
|
56
|
-
{
|
|
57
|
-
controlType: "text",
|
|
58
|
-
designType: "text",
|
|
59
|
-
text: "CERTIFICATE of QUALIFICATION",
|
|
60
|
-
fontSize: 20,
|
|
61
|
-
fontWeight: "700",
|
|
62
|
-
textAlign: "left",
|
|
63
|
-
fontFamily: "'BR Firma', sans-serif",
|
|
64
|
-
width: 500,
|
|
65
|
-
height: 50,
|
|
66
|
-
x: 83,
|
|
67
|
-
y: 174,
|
|
68
|
-
order: 0,
|
|
69
|
-
id: "0",
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
controlType: "text",
|
|
73
|
-
designType: "props",
|
|
74
|
-
type: "achievement",
|
|
75
|
-
bindingKey: "name",
|
|
76
|
-
text: "[인증서.제목]",
|
|
77
|
-
fontSize: 40,
|
|
78
|
-
fontWeight: "600",
|
|
79
|
-
textAlign: "left",
|
|
80
|
-
fontFamily: "Pretendard, sans-serif",
|
|
81
|
-
width: 500,
|
|
82
|
-
height: 50,
|
|
83
|
-
x: 87,
|
|
84
|
-
y: 214,
|
|
85
|
-
order: 1,
|
|
86
|
-
id: "1",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
controlType: "text",
|
|
90
|
-
designType: "props",
|
|
91
|
-
type: "user",
|
|
92
|
-
bindingKey: "name",
|
|
93
|
-
text: "[수령자.이름]",
|
|
94
|
-
fontSize: 44,
|
|
95
|
-
fontWeight: "600",
|
|
96
|
-
textAlign: "left",
|
|
97
|
-
fontFamily: "Pretendard, sans-serif",
|
|
98
|
-
width: 500,
|
|
99
|
-
height: 60,
|
|
100
|
-
x: 87,
|
|
101
|
-
y: 306,
|
|
102
|
-
order: 2,
|
|
103
|
-
id: "2",
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
controlType: "text",
|
|
107
|
-
designType: "props",
|
|
108
|
-
type: "achievement",
|
|
109
|
-
bindingKey: "description",
|
|
110
|
-
text: "[인증서.설명]",
|
|
111
|
-
fontSize: 24,
|
|
112
|
-
fontWeight: "400",
|
|
113
|
-
textAlign: "left",
|
|
114
|
-
fontFamily: "Pretendard, sans-serif",
|
|
115
|
-
width: 648,
|
|
116
|
-
height: 68,
|
|
117
|
-
x: 87,
|
|
118
|
-
y: 392,
|
|
119
|
-
order: 3,
|
|
120
|
-
id: "3",
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
controlType: "text",
|
|
124
|
-
designType: "props",
|
|
125
|
-
type: "achievement",
|
|
126
|
-
bindingKey: "tags",
|
|
127
|
-
text: "[인증서.스킬태그]",
|
|
128
|
-
fontSize: 16,
|
|
129
|
-
fontWeight: "400",
|
|
130
|
-
textAlign: "left",
|
|
131
|
-
color: "#6B7684",
|
|
132
|
-
fontFamily: "Pretendard, sans-serif",
|
|
133
|
-
width: 648,
|
|
134
|
-
height: 68,
|
|
135
|
-
x: 87,
|
|
136
|
-
y: 501,
|
|
137
|
-
order: 4,
|
|
138
|
-
id: "4",
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
controlType: "text",
|
|
142
|
-
designType: "text",
|
|
143
|
-
text: "수료기간",
|
|
144
|
-
fontSize: 16,
|
|
145
|
-
fontWeight: "600",
|
|
146
|
-
textAlign: "left",
|
|
147
|
-
fontFamily: "Pretendard, sans-serif",
|
|
148
|
-
width: 150,
|
|
149
|
-
height: 21,
|
|
150
|
-
x: 87,
|
|
151
|
-
y: 635,
|
|
152
|
-
order: 5,
|
|
153
|
-
id: "5",
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
controlType: "text",
|
|
157
|
-
designType: "props",
|
|
158
|
-
type: "achievement",
|
|
159
|
-
bindingKey: "period",
|
|
160
|
-
text: "[인증서.수료기간]",
|
|
161
|
-
fontSize: 16,
|
|
162
|
-
fontWeight: "400",
|
|
163
|
-
textAlign: "left",
|
|
164
|
-
fontFamily: "Pretendard, sans-serif",
|
|
165
|
-
width: 200,
|
|
166
|
-
height: 21,
|
|
167
|
-
x: 87,
|
|
168
|
-
y: 664,
|
|
169
|
-
order: 6,
|
|
170
|
-
id: "6",
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
controlType: "text",
|
|
174
|
-
designType: "text",
|
|
175
|
-
text: "발급일",
|
|
176
|
-
fontSize: 16,
|
|
177
|
-
fontWeight: "600",
|
|
178
|
-
textAlign: "left",
|
|
179
|
-
fontFamily: "Pretendard, sans-serif",
|
|
180
|
-
width: 150,
|
|
181
|
-
height: 21,
|
|
182
|
-
x: 295,
|
|
183
|
-
y: 635,
|
|
184
|
-
order: 7,
|
|
185
|
-
id: "7",
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
controlType: "text",
|
|
189
|
-
designType: "props",
|
|
190
|
-
type: "achievement",
|
|
191
|
-
bindingKey: "created_at",
|
|
192
|
-
text: "[인증서.발급일]",
|
|
193
|
-
fontSize: 16,
|
|
194
|
-
fontWeight: "400",
|
|
195
|
-
textAlign: "left",
|
|
196
|
-
fontFamily: "Pretendard, sans-serif",
|
|
197
|
-
width: 200,
|
|
198
|
-
height: 21,
|
|
199
|
-
x: 295,
|
|
200
|
-
y: 664,
|
|
201
|
-
order: 8,
|
|
202
|
-
id: "8",
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
controlType: "text",
|
|
206
|
-
designType: "text",
|
|
207
|
-
text: "발급기관",
|
|
208
|
-
fontSize: 16,
|
|
209
|
-
fontWeight: "600",
|
|
210
|
-
textAlign: "left",
|
|
211
|
-
fontFamily: "Pretendard, sans-serif",
|
|
212
|
-
width: 150,
|
|
213
|
-
height: 21,
|
|
214
|
-
x: 487,
|
|
215
|
-
y: 635,
|
|
216
|
-
order: 9,
|
|
217
|
-
id: "9",
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
controlType: "text",
|
|
221
|
-
designType: "props",
|
|
222
|
-
type: "club",
|
|
223
|
-
bindingKey: "name",
|
|
224
|
-
text: "[발급기관[1].이름]",
|
|
225
|
-
fontSize: 16,
|
|
226
|
-
fontWeight: "400",
|
|
227
|
-
textAlign: "left",
|
|
228
|
-
fontFamily: "Pretendard, sans-serif",
|
|
229
|
-
width: 160,
|
|
230
|
-
height: 30,
|
|
231
|
-
x: 487,
|
|
232
|
-
y: 664,
|
|
233
|
-
order: 10,
|
|
234
|
-
id: "10",
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
controlType: "text",
|
|
238
|
-
designType: "props",
|
|
239
|
-
type: "club",
|
|
240
|
-
bindingKey: "name_1",
|
|
241
|
-
text: "[발급기관[2].이름]",
|
|
242
|
-
fontSize: 16,
|
|
243
|
-
fontWeight: "400",
|
|
244
|
-
textAlign: "left",
|
|
245
|
-
fontFamily: "Pretendard, sans-serif",
|
|
246
|
-
width: 160,
|
|
247
|
-
height: 30,
|
|
248
|
-
x: 640,
|
|
249
|
-
y: 664,
|
|
250
|
-
order: 11,
|
|
251
|
-
id: "11",
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
controlType: "text",
|
|
255
|
-
designType: "props",
|
|
256
|
-
type: "club",
|
|
257
|
-
bindingKey: "name_2",
|
|
258
|
-
text: "[발급기관[3].이름]",
|
|
259
|
-
fontSize: 16,
|
|
260
|
-
fontWeight: "400",
|
|
261
|
-
textAlign: "left",
|
|
262
|
-
fontFamily: "Pretendard, sans-serif",
|
|
263
|
-
width: 160,
|
|
264
|
-
height: 30,
|
|
265
|
-
x: 487,
|
|
266
|
-
y: 690,
|
|
267
|
-
order: 12,
|
|
268
|
-
id: "12",
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
controlType: "text",
|
|
272
|
-
designType: "props",
|
|
273
|
-
type: "achievement",
|
|
274
|
-
bindingKey: "certificate_number",
|
|
275
|
-
text: "[인증서.발급코드]",
|
|
276
|
-
fontSize: 16,
|
|
277
|
-
fontWeight: "400",
|
|
278
|
-
textAlign: "right",
|
|
279
|
-
fontFamily: "Pretendard, sans-serif",
|
|
280
|
-
width: 200,
|
|
281
|
-
height: 70,
|
|
282
|
-
x: 790,
|
|
283
|
-
y: 701,
|
|
284
|
-
order: 13,
|
|
285
|
-
id: "13",
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
controlType: "image",
|
|
289
|
-
designType: "props",
|
|
290
|
-
type: "club",
|
|
291
|
-
bindingKey: "sign_image",
|
|
292
|
-
src: "",
|
|
293
|
-
text: "[발급기관[1].직인]",
|
|
294
|
-
fontSize: 16,
|
|
295
|
-
fontWeight: "400",
|
|
296
|
-
textAlign: "center",
|
|
297
|
-
fontFamily: "Pretendard, sans-serif",
|
|
298
|
-
width: 80,
|
|
299
|
-
height: 80,
|
|
300
|
-
x: 549,
|
|
301
|
-
y: 583,
|
|
302
|
-
order: 14,
|
|
303
|
-
id: "14",
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
controlType: "image",
|
|
307
|
-
designType: "props",
|
|
308
|
-
type: "club",
|
|
309
|
-
bindingKey: "sign_image_1",
|
|
310
|
-
src: "",
|
|
311
|
-
text: "[발급기관[2].직인]",
|
|
312
|
-
fontSize: 16,
|
|
313
|
-
fontWeight: "400",
|
|
314
|
-
textAlign: "center",
|
|
315
|
-
fontFamily: "Pretendard, sans-serif",
|
|
316
|
-
width: 80,
|
|
317
|
-
height: 80,
|
|
318
|
-
x: 629,
|
|
319
|
-
y: 583,
|
|
320
|
-
order: 15,
|
|
321
|
-
id: "15",
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
controlType: "image",
|
|
325
|
-
designType: "props",
|
|
326
|
-
type: "club",
|
|
327
|
-
bindingKey: "sign_image_2",
|
|
328
|
-
src: "",
|
|
329
|
-
text: "[발급기관[3].직인]",
|
|
330
|
-
fontSize: 16,
|
|
331
|
-
fontWeight: "400",
|
|
332
|
-
textAlign: "center",
|
|
333
|
-
fontFamily: "Pretendard, sans-serif",
|
|
334
|
-
width: 80,
|
|
335
|
-
height: 80,
|
|
336
|
-
x: 709,
|
|
337
|
-
y: 583,
|
|
338
|
-
order: 16,
|
|
339
|
-
id: "16",
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
controlType: "image",
|
|
343
|
-
designType: "props",
|
|
344
|
-
type: "club",
|
|
345
|
-
bindingKey: "club_symbol",
|
|
346
|
-
src: "",
|
|
347
|
-
text: "[발급기관[1].심볼]",
|
|
348
|
-
fontSize: 16,
|
|
349
|
-
fontWeight: "400",
|
|
350
|
-
textAlign: "center",
|
|
351
|
-
fontFamily: "Pretendard, sans-serif",
|
|
352
|
-
width: 90,
|
|
353
|
-
height: 90,
|
|
354
|
-
x: 852,
|
|
355
|
-
y: 92,
|
|
356
|
-
order: 17,
|
|
357
|
-
id: "17",
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
controlType: "image",
|
|
361
|
-
designType: "props",
|
|
362
|
-
type: "club",
|
|
363
|
-
bindingKey: "club_symbol_1",
|
|
364
|
-
src: "",
|
|
365
|
-
text: "[발급기관[2].심볼]",
|
|
366
|
-
fontSize: 16,
|
|
367
|
-
fontWeight: "400",
|
|
368
|
-
textAlign: "center",
|
|
369
|
-
fontFamily: "Pretendard, sans-serif",
|
|
370
|
-
width: 90,
|
|
371
|
-
height: 90,
|
|
372
|
-
x: 974,
|
|
373
|
-
y: 92,
|
|
374
|
-
order: 18,
|
|
375
|
-
id: "18",
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
controlType: "image",
|
|
379
|
-
designType: "props",
|
|
380
|
-
type: "achievement",
|
|
381
|
-
bindingKey: "qr_code",
|
|
382
|
-
src: "",
|
|
383
|
-
text: "[인증서.QR코드]",
|
|
384
|
-
fontSize: 16,
|
|
385
|
-
fontWeight: "400",
|
|
386
|
-
textAlign: "center",
|
|
387
|
-
fontFamily: "Pretendard, sans-serif",
|
|
388
|
-
width: 90,
|
|
389
|
-
height: 90,
|
|
390
|
-
x: 989,
|
|
391
|
-
y: 639,
|
|
392
|
-
order: 19,
|
|
393
|
-
id: "19",
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
controlType: "image",
|
|
397
|
-
designType: "props",
|
|
398
|
-
type: "achievement",
|
|
399
|
-
bindingKey: "badge",
|
|
400
|
-
src: "",
|
|
401
|
-
text: "[인증서.배지]",
|
|
402
|
-
fontSize: 16,
|
|
403
|
-
fontWeight: "400",
|
|
404
|
-
textAlign: "center",
|
|
405
|
-
fontFamily: "Pretendard, sans-serif",
|
|
406
|
-
width: 280,
|
|
407
|
-
height: 280,
|
|
408
|
-
x: 784,
|
|
409
|
-
y: 305.5,
|
|
410
|
-
order: 20,
|
|
411
|
-
id: "20",
|
|
412
|
-
},
|
|
16
|
+
achievement: {
|
|
17
|
+
id: 1450,
|
|
18
|
+
certificate_number: "CERT-202504-123456",
|
|
19
|
+
expiration_date: "2025-12-02T00:00:00.000Z",
|
|
20
|
+
is_received: false,
|
|
21
|
+
issuance_method: "EMAIL",
|
|
22
|
+
created_at: "2025-04-18T00:00:00.000Z",
|
|
23
|
+
updated_at: "2025-04-06T18:17:39.116Z",
|
|
24
|
+
user: {
|
|
25
|
+
email: "eogks999@naver.com",
|
|
26
|
+
name: "김천재",
|
|
27
|
+
avatar: [
|
|
28
|
+
"https://ufcglnoegwgklehhpzlj.supabase.co/storage/v1/object/public/blockspoon_images/uploads/user/avatar/background.webp",
|
|
29
|
+
"https://ufcglnoegwgklehhpzlj.supabase.co/storage/v1/object/public/blockspoon_images/uploads/user/avatar/clothes.webp",
|
|
30
|
+
"https://ufcglnoegwgklehhpzlj.supabase.co/storage/v1/object/public/blockspoon_images/uploads/user/avatar/face.webp",
|
|
31
|
+
"https://ufcglnoegwgklehhpzlj.supabase.co/storage/v1/object/public/blockspoon_images/uploads/user/avatar/eye.webp",
|
|
32
|
+
"https://ufcglnoegwgklehhpzlj.supabase.co/storage/v1/object/public/blockspoon_images/uploads/user/avatar/hair.webp",
|
|
33
|
+
"https://ufcglnoegwgklehhpzlj.supabase.co/storage/v1/object/public/blockspoon_images/uploads/user/avatar/mouth.webp",
|
|
34
|
+
"https://ufcglnoegwgklehhpzlj.supabase.co/storage/v1/object/public/blockspoon_images/uploads/user/avatar/accessory.webp",
|
|
413
35
|
],
|
|
414
|
-
|
|
415
|
-
created_at: "2025-04-09T18:37:39.696Z",
|
|
416
|
-
updated_at: "2025-04-09T18:37:39.696Z",
|
|
36
|
+
deleted_at: null,
|
|
417
37
|
image: null,
|
|
38
|
+
profileImageType: "avatar",
|
|
418
39
|
},
|
|
419
|
-
|
|
420
|
-
id:
|
|
421
|
-
name: "
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
40
|
+
achievementForm: {
|
|
41
|
+
id: 496,
|
|
42
|
+
name: "OpenApi 테스트 인증서",
|
|
43
|
+
achievementBadgeDesign: {
|
|
44
|
+
id: 64,
|
|
45
|
+
name: "배지리본합체!",
|
|
46
|
+
main_color: "#FF1B64",
|
|
47
|
+
sub_color: "#FF8FB1",
|
|
48
|
+
extra_color_1: "#000000",
|
|
49
|
+
extra_color_2: "#000000",
|
|
50
|
+
layout_json: [
|
|
51
|
+
{
|
|
52
|
+
id: "badge-1742881999662",
|
|
53
|
+
controlType: "svg",
|
|
54
|
+
designType: "badge",
|
|
55
|
+
componentName: "BadgeType63",
|
|
56
|
+
background: "transparent",
|
|
57
|
+
width: 500,
|
|
58
|
+
height: 530,
|
|
59
|
+
x: 48,
|
|
60
|
+
y: 44,
|
|
61
|
+
order: 1,
|
|
62
|
+
text: "BadgeType63",
|
|
63
|
+
mainColor: "#FF1B64",
|
|
64
|
+
subColor: "#FF91B2",
|
|
65
|
+
extraColor1: "yellow",
|
|
66
|
+
extraColor2: "green",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "ribbon-1742881765599",
|
|
70
|
+
controlType: "svg",
|
|
71
|
+
designType: "ribbon",
|
|
72
|
+
componentName: "RibbonType7",
|
|
73
|
+
background: "transparent",
|
|
74
|
+
width: 510,
|
|
75
|
+
height: 210,
|
|
76
|
+
x: 45,
|
|
77
|
+
y: 195,
|
|
78
|
+
order: 2,
|
|
79
|
+
text: "RibbonType7",
|
|
80
|
+
mainColor: "#FF1B64",
|
|
81
|
+
subColor: "#FF91B2",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "2",
|
|
85
|
+
order: 3,
|
|
86
|
+
controlType: "text",
|
|
87
|
+
designType: "props",
|
|
88
|
+
type: "club",
|
|
89
|
+
bindingKey: "name",
|
|
90
|
+
text: "미세먼지 그만",
|
|
91
|
+
fontSize: 28,
|
|
92
|
+
fontWeight: "700",
|
|
93
|
+
textAlign: "center",
|
|
94
|
+
fontFamily: "Pretendard, sans-serif",
|
|
95
|
+
color: "black",
|
|
96
|
+
width: 335,
|
|
97
|
+
height: 50,
|
|
98
|
+
x: 135,
|
|
99
|
+
y: 405,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "club-symbol",
|
|
103
|
+
order: 3,
|
|
104
|
+
controlType: "image",
|
|
105
|
+
designType: "props",
|
|
106
|
+
type: "club",
|
|
107
|
+
bindingKey: "club_symbol",
|
|
108
|
+
src: "https://ufcglnoegwgklehhpzlj.supabase.co/storage/v1/object/public/blockspoon_images/uploads/club/symbol/8a4656a6-eda5-4356-8240-155e70982e0e",
|
|
109
|
+
text: "[발급기관[1].심볼]",
|
|
110
|
+
fontSize: 16,
|
|
111
|
+
fontWeight: "400",
|
|
112
|
+
textAlign: "center",
|
|
113
|
+
fontFamily: "Pretendard, sans-serif",
|
|
114
|
+
width: 90,
|
|
115
|
+
height: 90,
|
|
116
|
+
x: 423,
|
|
117
|
+
y: 86,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "0",
|
|
121
|
+
order: 4,
|
|
122
|
+
controlType: "text",
|
|
123
|
+
designType: "text",
|
|
124
|
+
text: "· CERTIFICATE of COMPLETION ·",
|
|
125
|
+
fontSize: 16,
|
|
126
|
+
fontWeight: "600",
|
|
127
|
+
textAlign: "center",
|
|
128
|
+
fontFamily: "Pretendard, sans-serif",
|
|
129
|
+
color: "black",
|
|
130
|
+
width: 279,
|
|
131
|
+
height: 38,
|
|
132
|
+
x: 162,
|
|
133
|
+
y: 172,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "1",
|
|
137
|
+
order: 5,
|
|
138
|
+
controlType: "text",
|
|
139
|
+
designType: "props",
|
|
140
|
+
type: "achievement",
|
|
141
|
+
bindingKey: "name",
|
|
142
|
+
text: "OpenApi 테스트 인증서",
|
|
143
|
+
fontSize: 48,
|
|
144
|
+
fontWeight: "700",
|
|
145
|
+
textAlign: "center",
|
|
146
|
+
fontFamily: "Pretendard, sans-serif",
|
|
147
|
+
width: 360,
|
|
148
|
+
height: 120,
|
|
149
|
+
x: 125,
|
|
150
|
+
y: 240,
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
template_type: "NewBadgeTypeEmpty",
|
|
154
|
+
created_at: "2025-04-09T18:37:27.940Z",
|
|
155
|
+
updated_at: "2025-04-09T18:37:27.940Z",
|
|
156
|
+
},
|
|
157
|
+
club: {
|
|
158
|
+
domain: "ddenzu2",
|
|
159
|
+
name: "미세먼지 그만",
|
|
160
|
+
type: "school",
|
|
161
|
+
images: [
|
|
162
|
+
{
|
|
163
|
+
path: "https://ufcglnoegwgklehhpzlj.supabase.co/storage/v1/object/public/blockspoon_images/uploads/club/logo/5af4890f-8906-4562-92ee-d511742e5d39",
|
|
164
|
+
type: "club_logo",
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
path: "https://ufcglnoegwgklehhpzlj.supabase.co/storage/v1/object/public/blockspoon_images/uploads/club/symbol/8a4656a6-eda5-4356-8240-155e70982e0e",
|
|
168
|
+
type: "club_symbol",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
path: "https://ufcglnoegwgklehhpzlj.supabase.co/storage/v1/object/public/blockspoon_images/uploads/achievement/form/sign/fb38b4e8-5a26-40a2-b827-7e8044f058a6",
|
|
172
|
+
type: "sign_image",
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
},
|
|
515
176
|
},
|
|
516
177
|
},
|
|
517
178
|
};
|
|
518
179
|
|
|
519
180
|
const testCertificateData = {
|
|
520
181
|
// user: test_object.achievement.user,
|
|
521
|
-
|
|
522
|
-
kollegeInfo: test_object.achievementForm.club,
|
|
523
|
-
achievementInfo: test_object.achievementForm,
|
|
182
|
+
achievementInfo: test_object.achievement,
|
|
524
183
|
};
|
|
525
184
|
const testOptions = {
|
|
526
185
|
type: "badge",
|
|
@@ -528,71 +187,61 @@ const testOptions = {
|
|
|
528
187
|
returnType: "base64",
|
|
529
188
|
};
|
|
530
189
|
|
|
531
|
-
|
|
532
|
-
const testDesignData = {
|
|
533
|
-
layout_json: test_object.achievementForm.achievementBadgeDesign.layout_json,
|
|
534
|
-
template_type:
|
|
535
|
-
test_object.achievementForm.achievementBadgeDesign.template_type,
|
|
536
|
-
main_color: test_object.achievementForm.achievementBadgeDesign.main_color,
|
|
537
|
-
sub_color: test_object.achievementForm.achievementBadgeDesign.sub_color,
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
|
|
541
190
|
async function runTests() {
|
|
542
191
|
try {
|
|
543
192
|
// HTML 변환 테스트
|
|
544
|
-
const htmlOutput = await generateDesignHTML(testDesignData, {
|
|
545
|
-
size: 300,
|
|
546
|
-
});
|
|
547
|
-
fs.writeFileSync("test/certificate.html", htmlOutput, "utf8");
|
|
548
|
-
console.log("✅ HTML 변환 완료: test/certificate.html");
|
|
549
|
-
|
|
550
|
-
// PNG 변환 테스트
|
|
551
|
-
const pngResult = await generateDesignFile(testDesignData, {
|
|
552
|
-
size: 300,
|
|
553
|
-
});
|
|
554
|
-
fs.writeFileSync("test/certificate.png", pngResult.buffer);
|
|
555
|
-
console.log("✅ PNG 변환 완료: test/certificate.png");
|
|
556
|
-
|
|
557
|
-
// // HTML 변환 테스트
|
|
558
|
-
// const htmlOutput = await generateAchievementHTML(testCertificateData, {
|
|
559
|
-
// type: "badge",
|
|
193
|
+
// const htmlOutput = await generateDesignHTML(testDesignData, {
|
|
560
194
|
// size: 300,
|
|
561
|
-
// noSpace: false,
|
|
562
|
-
// mainColor: "#322899",
|
|
563
|
-
// subColor: "#7368E8",
|
|
564
195
|
// });
|
|
565
196
|
// fs.writeFileSync("test/certificate.html", htmlOutput, "utf8");
|
|
566
197
|
// console.log("✅ HTML 변환 완료: test/certificate.html");
|
|
567
198
|
|
|
568
199
|
// // PNG 변환 테스트
|
|
569
|
-
// const pngResult = await
|
|
570
|
-
//
|
|
571
|
-
//
|
|
572
|
-
// );
|
|
200
|
+
// const pngResult = await generateDesignFile(testDesignData, {
|
|
201
|
+
// size: 300,
|
|
202
|
+
// });
|
|
203
|
+
// fs.writeFileSync("test/certificate.png", pngResult.buffer);
|
|
204
|
+
// console.log("✅ PNG 변환 완료: test/certificate.png");
|
|
205
|
+
|
|
206
|
+
// // HTML 변환 테스트
|
|
207
|
+
const htmlOutput = await generateAchievementHTML(testCertificateData.achievementInfo, {
|
|
208
|
+
type: "badge",
|
|
209
|
+
size: 300,
|
|
210
|
+
noSpace: false,
|
|
211
|
+
mainColor: "#322899",
|
|
212
|
+
subColor: "#7368E8",
|
|
213
|
+
});
|
|
214
|
+
fs.writeFileSync("test/certificate.html", htmlOutput, "utf8");
|
|
215
|
+
// console.log("✅ HTML 변환 완료: test/certificate.html");
|
|
216
|
+
|
|
217
|
+
// PNG 변환 테스트
|
|
218
|
+
const pngResult = await generateAchievementFile(
|
|
219
|
+
testCertificateData.achievementInfo,
|
|
220
|
+
testOptions
|
|
221
|
+
);
|
|
573
222
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
223
|
+
if (testOptions.returnType === "base64") {
|
|
224
|
+
console.log("✅ Base64 변환 완료");
|
|
225
|
+
// base64 문자열에서 data:image/png;base64, 부분 제거
|
|
226
|
+
const base64Data = pngResult.base64.replace(
|
|
227
|
+
/^data:image\/png;base64,/,
|
|
228
|
+
""
|
|
229
|
+
);
|
|
230
|
+
// base64를 버퍼로 변환
|
|
231
|
+
const buffer = Buffer.from(base64Data, "base64");
|
|
232
|
+
// 이미지 파일로 저장
|
|
233
|
+
await fsPromises.writeFile(
|
|
234
|
+
path.join(__dirname, "certificate_base64.png"),
|
|
235
|
+
buffer
|
|
236
|
+
);
|
|
237
|
+
console.log("✅ Base64 이미지 저장 완료: test/certificate_base64.png");
|
|
238
|
+
} else {
|
|
239
|
+
await fsPromises.writeFile(
|
|
240
|
+
path.join(__dirname, "certificate.png"),
|
|
241
|
+
pngResult.buffer
|
|
242
|
+
);
|
|
243
|
+
console.log("✅ PNG 변환 완료: test/certificate.png");
|
|
244
|
+
}
|
|
596
245
|
} catch (error) {
|
|
597
246
|
console.error("❌ 테스트 실행 중 오류 발생:", error);
|
|
598
247
|
}
|