Skip to content

Commit a203db2

Browse files
committed
fix tipe data javascript
1 parent 1580101 commit a203db2

2 files changed

Lines changed: 308 additions & 0 deletions

File tree

models/example_spp.json

Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
{
2+
"model_name": "SPP Payment System",
3+
"version": "1.0",
4+
"domains": [
5+
{
6+
"name": "userManagement",
7+
"description": "Sistem untuk mengelola data dan aktivitas pengguna."
8+
},
9+
{
10+
"name": "penangananTagihan",
11+
"description": "Sistem untuk mengelola tagihan dan proses pembayaran SPP."
12+
},
13+
{
14+
"name": "administrasiKeuangan",
15+
"description": "Sistem untuk mengarsip aktivitas dan transaksi pengguna."
16+
}
17+
],
18+
"classes": [
19+
{
20+
"name": "User",
21+
"domain_ref": "userManagement",
22+
"description": "Class untuk pengguna sistem",
23+
"attributes": [
24+
{"name": "userID", "type": "int"},
25+
{"name": "username", "type": "str"},
26+
{"name": "email", "type": "str"},
27+
{"name": "passwordHash", "type": "str"},
28+
{"name": "role", "type": "str"}
29+
]
30+
},
31+
{
32+
"name": "Permission",
33+
"domain_ref": "userManagement",
34+
"description": "Hak akses pengguna",
35+
"attributes": [
36+
{"name": "permissionID", "type": "int"},
37+
{"name": "permissionName", "type": "str"},
38+
{"name": "description", "type": "str"}
39+
]
40+
},
41+
{
42+
"name": "AuthSession",
43+
"domain_ref": "userManagement",
44+
"attributes": [
45+
{"name": "sessionID", "type": "int"},
46+
{"name": "userID", "type": "int"},
47+
{"name": "token", "type": "str"},
48+
{"name": "expiredAt", "type": "datetime"},
49+
{"name": "sessionState", "type": "str"}
50+
],
51+
"state_model": [
52+
{
53+
"initial_state": "LoggedOut",
54+
"states": [
55+
{"name": "LoggedOut"},
56+
{"name": "LoggingIn"},
57+
{"name": "LoggedIn"},
58+
{"name": "Expired"}
59+
],
60+
"transitions": [
61+
{"from": "LoggedOut", "to": "LoggingIn", "event": "attemptLogin", "action": "validateCredentials()"},
62+
{"from": "LoggingIn", "to": "LoggedIn", "event": "loginSuccess", "action": "createSession()"},
63+
{"from": "LoggingIn", "to": "LoggedOut", "event": "sessionEnd", "action": "deleteSession()"},
64+
{"from": "LoggingIn", "to": "Expired", "event": "sessionExpired", "action": "refreshSession()"},
65+
{"from": "LoggedIn", "to": "LoggingIn", "event": "attemptLogin", "action": "validateCredentials()"},
66+
{"from": "LoggedIn", "to": "LoggedIn", "event": "logginSuccess", "action": "createSession()"},
67+
{"from": "LoggedIn", "to": "Expired", "event": "sessionExpired", "action": "refreshSession()"},
68+
{"from": "LoggedIn", "to": "LoggedOut", "event": "sessionEnd", "action": "deleteSession()"},
69+
{"from": "Expired", "to": "LoggingIn", "event": "attemptLogin", "action": "validateCredentials()"},
70+
{"from": "Expired", "to": "LoggedIn", "event": "loginSuccess", "action": "createSession()"},
71+
{"from": "Expired", "to": "LoggedOut", "event": "sessionEnd", "action": "deleteSession()"}
72+
]
73+
}
74+
]
75+
},
76+
{
77+
"name": "ResetPassword",
78+
"domain_ref": "userManagement",
79+
"attributes": [
80+
{"name": "resetID", "type": "int"},
81+
{"name": "userID", "type": "int"},
82+
{"name": "resetToken", "type": "str"},
83+
{"name": "createdAt", "type": "datetime"},
84+
{"name": "expiredAt", "type": "datetime"}
85+
]
86+
},
87+
{
88+
"name": "Tagihan",
89+
"domain_ref": "penangananTagihan",
90+
"attributes": [
91+
{"name": "tagihanID", "type": "int"},
92+
{"name": "userID", "type": "int"},
93+
{"name": "periode", "type": "datetime"},
94+
{"name": "nominalTagihan", "type": "float"},
95+
{"name": "jumlahTerbayar", "type": "float"},
96+
{"name": "denda", "type": "float"},
97+
{"name": "statusTagihan", "type": "str"},
98+
{"name": "createdAt", "type": "datetime"},
99+
{"name": "tanggalJatuhTempo", "type": "datetime"}
100+
],
101+
"state_model": [
102+
{
103+
"initial_state": "Publish",
104+
"states": [
105+
{"name": "Publish"},
106+
{"name": "Outstansing"},
107+
{"name": "Lunas"},
108+
{"name": "Terlambat"},
109+
{"name": "Clear"}
110+
],
111+
"transitions": [
112+
{"from": "Publish", "to": "Lunas", "event": "payFull", "action": "closeInvoice()"},
113+
{"from": "Publish", "to": "Terlambat", "event": "markAsLate", "action": "calculatePenalty()"},
114+
{"from": "Publish", "to": "Clear", "event": "withdrawn", "action": "clearInvoice()"},
115+
{"from": "Publish", "to": "Outstanding", "event": "payPartial", "action": "calculateRemain()"},
116+
{"from": "Outstanding", "to": "Lunas", "event": "payFull", "action": "closeInvoice()"},
117+
{"from": "Outstanding", "to": "Terlambat", "event": "markAsLate", "action": "saveRemain()"},
118+
{"from": "Outstanding", "to": "Clear", "event": "withdrawn", "action": "clearInvoice()"},
119+
{"from": "Outstanding", "to": "Outstanding", "event": "payPartial", "action": "calculateRemain()"},
120+
{"from": "Lunas", "to": "Clear", "event": "withdrawn", "action": "clearInvoice()"},
121+
{"from": "Terlambat", "to": "Lunas", "event": "payFull", "action": "closeInvoice()"},
122+
{"from": "Terlambat", "to": "Clear", "event": "withdrawn", "action": "clearInvoice()"},
123+
{"from": "Terlambat", "to": "Terlambat", "event": "payPartial", "action": "calculatePenalty()"}
124+
]
125+
}
126+
]
127+
},
128+
{
129+
"name": "Pembayaran",
130+
"domain_ref": "penangananTagihan",
131+
"attributes": [
132+
{"name": "pembayaranID", "type": "int"},
133+
{"name": "gatewayID", "type": "int"},
134+
{"name": "tagihanID", "type": "int"},
135+
{"name": "userID", "type": "int"},
136+
{"name": "jumlahBayar", "type": "float"},
137+
{"name": "tanggalBayar", "type": "datetime"},
138+
{"name": "statusPembayaran", "type": "str"}
139+
],
140+
"state_model": [
141+
{
142+
"initial_state": "Draft",
143+
"states": [
144+
{"name": "Draft"},
145+
{"name": "Waiting"},
146+
{"name": "Berhasil"},
147+
{"name": "Gagal"},
148+
{"name": "Cancel"},
149+
{"name": "Timeout"}
150+
],
151+
"transitions": [
152+
{"from": "Draft", "to": "Waiting", "event": "initiatePay","action": "None"},
153+
{"from": "Draft", "to": "Draft", "event": "reSubmit", "action": "createPayment()"},
154+
{"from": "Waiting", "to": "Gagal", "event": "verifyFail", "action": "destroyPayment()"},
155+
{"from": "Waiting", "to": "Berhasil", "event": "verifySuccess", "action": "endPayment()"},
156+
{"from": "Waiting", "to": "Cancel", "event": "closePay", "action": "None"},
157+
{"from": "Waiting", "to": "Timeout", "event": "terminate","action": "None"},
158+
{"from": "Berhasil", "to": "Berhasil", "event": "verifySuccess", "action": "None"},
159+
{"from": "Gagal", "to": "Gagal", "event": "verifyFail", "action": "None"},
160+
{"from": "Gagal", "to": "Draft", "event": "reSubmit", "action": "createPayment()"},
161+
{"from": "Cancel", "to": "Gagal", "event": "verifyFail", "action": "destroyPayment()"},
162+
{"from": "Timeout", "to": "Gagal", "event": "verifyFail", "action": "destroyPayment()"}
163+
]
164+
}
165+
]
166+
},
167+
{
168+
"name": "GatewayAPI",
169+
"domain_ref": "penangananTagihan",
170+
"attributes": [
171+
{"name": "gatewayID", "type": "int"},
172+
{"name": "namaGateway", "type": "str"},
173+
{"name": "endpointAPI", "type": "str"},
174+
{"name": "apiKey", "type": "str"}
175+
]
176+
},
177+
{
178+
"name": "Beasiswa",
179+
"domain_ref": "penangananTagihan",
180+
"attributes": [
181+
{"name": "beasiswaID", "type": "int"},
182+
{"name": "namaBeasiswa", "type": "str"},
183+
{"name": "jenisBeasiswa", "type": "str"},
184+
{"name": "potonganBeasiswa", "type": "float"},
185+
{"name": "periodeBeasiswa", "type": "datetime"},
186+
{"name": "jumlahPenerima", "type": "float"}
187+
]
188+
},
189+
{
190+
"name": "Notifikasi",
191+
"domain_ref": "penangananTagihan",
192+
"attributes": [
193+
{"name": "notifikasiID", "type": "int"},
194+
{"name": "tagihanID", "type": "int"},
195+
{"name": "pembayaranID", "type": "int"},
196+
{"name": "pesanNotifikasi", "type": "str"},
197+
{"name": "tanggalKirim", "type": "datetime"}
198+
]
199+
},
200+
{
201+
"name": "Rekonsiliasi",
202+
"domain_ref": "administrasiKeuangan",
203+
"attributes": [
204+
{"name": "rekonsiliasiID", "type": "int"},
205+
{"name": "pembayaranID", "type": "int"},
206+
{"name": "tanggalRekonsiliasi", "type": "datetime"},
207+
{"name": "sumberEksternal", "type": "str"},
208+
{"name": "keterangan", "type": "str"}
209+
]
210+
},
211+
{
212+
"name": "ArsipTransaksi",
213+
"domain_ref": "administrasiKeuangan",
214+
"attributes": [
215+
{"name": "arsipID", "type": "int"},
216+
{"name": "tanggalArsip", "type": "datetime"},
217+
{"name": "jumlahBayar", "type": "float"}
218+
]
219+
},
220+
{
221+
"name": "LaporanKeuangan",
222+
"domain_ref": "administrasiKeuangan",
223+
"attributes": [
224+
{"name": "laporanID", "type": "int"},
225+
{"name": "arsipID", "type": "int"},
226+
{"name": "periode", "type": "datetime"},
227+
{"name": "totalPendapatan", "type": "float"},
228+
{"name": "totalBeasiswa", "type": "float"},
229+
{"name": "totalTransaksi", "type": "float"},
230+
{"name": "tanngalCetak", "type": "datetime"},
231+
{"name": "disetujuiOleh", "type": "str"}
232+
]
233+
},
234+
{
235+
"name": "LogTransaksi",
236+
"domain_ref": "administrasiKeuangan",
237+
"attributes": [
238+
{"name": "logID", "type": "int"},
239+
{"name": "pembayaranID", "type": "int"},
240+
{"name": "aksi", "type": "str"},
241+
{"name": "timestampAksi", "type": "datetime"}
242+
]
243+
}
244+
],
245+
"events": [
246+
{
247+
"name": "attemptLogin",
248+
"trigger": "AuthSession",
249+
"action": "validateCredentials()"
250+
},
251+
{
252+
"name": "loginSuccess",
253+
"trigger": "AuthSession",
254+
"action": "createSession()"
255+
},
256+
{
257+
"name": "sessionExpired",
258+
"trigger": "AuthSession",
259+
"action": "refreshSession()"
260+
},
261+
{
262+
"name": "sessionEnd",
263+
"trigger": "AuthSession",
264+
"action": "deleteSession()"
265+
},
266+
{
267+
"name": "payFull",
268+
"trigger": "Tagihan",
269+
"action": "closeInvoice()"
270+
},
271+
{
272+
"name": "markAsLate",
273+
"trigger": "Tagihan",
274+
"action": "saveRemain() -> calculatePenalty()"
275+
},
276+
{
277+
"name": "withdrawn",
278+
"trigger": "Tagihan",
279+
"action": "clearInvoice()"
280+
},
281+
{
282+
"name": "payPartial",
283+
"trigger": "Tagihan",
284+
"action": "calculateRemain()"
285+
},
286+
{
287+
"name": "reSubmit",
288+
"trigger": "Pembayaran",
289+
"action": "createPayment()"
290+
},
291+
{
292+
"name": "verifyFail",
293+
"trigger": "Pembayaran",
294+
"action": "destroyPayment()"
295+
},
296+
{
297+
"name": "verifySuccess",
298+
"trigger": "Pembayaran",
299+
"action": "endPayment()"
300+
}
301+
]
302+
}

src/templates/javascript/class.js.tera

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ export class {{ class.name }} {
33
{%- if class.domain_ref is defined and class.domain_ref %}
44
// Domain Reference: {{ class.domain_ref }}
55
{% endif %}
6+
/**
7+
    * @constructor
8+
{%- for a in class.attributes %}
9+
    * @param { {{ a.type }} } {{ a.name }}
10+
{%- endfor %}
11+
    */
612
constructor({% if class.attributes | length > 0 %}{% for a in class.attributes %}{{ a.name }}{% if not loop.last %}, {% endif %}{% endfor %}{% endif %}) {
713
{%- if class.attributes | length == 0 %}
814
// no attributes

0 commit comments

Comments
 (0)