Skip to content

Commit ed26ad1

Browse files
committed
casing
1 parent a0b4b41 commit ed26ad1

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

dbos/admin_server.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -107,47 +107,47 @@ type adminServer struct {
107107
// not super ergonomic but the DBOS console excepts unix timestamps
108108
func workflowStatusToUTC(ws WorkflowStatus) map[string]any {
109109
result := map[string]any{
110-
"workflow_uuid": ws.ID,
111-
"status": ws.Status,
112-
"name": ws.Name,
113-
"authenticated_user": ws.AuthenticatedUser,
114-
"assumed_role": ws.AssumedRole,
115-
"authenticated_roles": ws.AuthenticatedRoles,
116-
"output": ws.Output,
117-
"error": ws.Error,
118-
"executor_id": ws.ExecutorID,
119-
"application_version": ws.ApplicationVersion,
120-
"application_id": ws.ApplicationID,
121-
"attempts": ws.Attempts,
122-
"queue_name": ws.QueueName,
123-
"timeout": ws.Timeout,
124-
"deduplication_id": ws.DeduplicationID,
125-
"input": ws.Input,
110+
"WorkflowUUID": ws.ID,
111+
"Status": ws.Status,
112+
"Name": ws.Name,
113+
"AuthenticatedUser": ws.AuthenticatedUser,
114+
"AssumedRole": ws.AssumedRole,
115+
"AuthenticatedRoles": ws.AuthenticatedRoles,
116+
"Output": ws.Output,
117+
"Error": ws.Error,
118+
"ExecutorID": ws.ExecutorID,
119+
"ApplicationVersion": ws.ApplicationVersion,
120+
"ApplicationID": ws.ApplicationID,
121+
"Attempts": ws.Attempts,
122+
"QueueName": ws.QueueName,
123+
"Timeout": ws.Timeout,
124+
"DeduplicationID": ws.DeduplicationID,
125+
"Input": ws.Input,
126126
}
127127

128128
// Convert time fields to UTC Unix timestamps (milliseconds)
129129
if !ws.CreatedAt.IsZero() {
130-
result["created_at"] = ws.CreatedAt.UTC().UnixMilli()
130+
result["CreatedAt"] = ws.CreatedAt.UTC().UnixMilli()
131131
} else {
132-
result["created_at"] = nil
132+
result["CreatedAt"] = nil
133133
}
134134

135135
if !ws.UpdatedAt.IsZero() {
136-
result["updated_at"] = ws.UpdatedAt.UTC().UnixMilli()
136+
result["UpdatedAt"] = ws.UpdatedAt.UTC().UnixMilli()
137137
} else {
138-
result["updated_at"] = nil
138+
result["UpdatedAt"] = nil
139139
}
140140

141141
if !ws.Deadline.IsZero() {
142-
result["deadline"] = ws.Deadline.UTC().UnixMilli()
142+
result["Deadline"] = ws.Deadline.UTC().UnixMilli()
143143
} else {
144-
result["deadline"] = nil
144+
result["Deadline"] = nil
145145
}
146146

147147
if !ws.StartedAt.IsZero() {
148-
result["started_at"] = ws.StartedAt.UTC().UnixMilli()
148+
result["StartedAt"] = ws.StartedAt.UTC().UnixMilli()
149149
} else {
150-
result["started_at"] = nil
150+
result["StartedAt"] = nil
151151
}
152152

153153
return result

dbos/admin_server_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,18 @@ func TestAdminServer(t *testing.T) {
213213
// Verify timestamps are epoch milliseconds
214214
timeBetweenMillis := timeBetween.UnixMilli()
215215
for _, wf := range workflows1 {
216-
_, ok := wf["created_at"].(float64)
217-
require.True(t, ok, "created_at should be a number")
216+
_, ok := wf["CreatedAt"].(float64)
217+
require.True(t, ok, "CreatedAt should be a number")
218218
}
219219
// Verify the timestamp is around timeBetween (within 2 seconds before or after)
220-
assert.Less(t, int64(workflows1[0]["created_at"].(float64)), timeBetweenMillis, "first workflow CreatedAt should be before timeBetween")
221-
assert.Greater(t, int64(workflows1[1]["created_at"].(float64)), timeBetweenMillis, "second workflow CreatedAt should be before timeBetween")
220+
assert.Less(t, int64(workflows1[0]["CreatedAt"].(float64)), timeBetweenMillis, "first workflow CreatedAt should be before timeBetween")
221+
assert.Greater(t, int64(workflows1[1]["CreatedAt"].(float64)), timeBetweenMillis, "second workflow CreatedAt should be before timeBetween")
222222

223223
// Verify both workflow IDs are present
224224
foundIDs1 := make(map[string]bool)
225225
for _, wf := range workflows1 {
226-
id, ok := wf["workflow_uuid"].(string)
227-
require.True(t, ok, "workflow_uuid should be a string")
226+
id, ok := wf["WorkflowUUID"].(string)
227+
require.True(t, ok, "WorkflowUUID should be a string")
228228
foundIDs1[id] = true
229229
}
230230
assert.True(t, foundIDs1[workflowID1], "Expected to find first workflow ID in results")
@@ -253,8 +253,8 @@ func TestAdminServer(t *testing.T) {
253253
assert.Equal(t, 1, len(workflows2), "Expected exactly 1 workflow with start_time after timeBetween")
254254

255255
// Verify it's the second workflow
256-
id2, ok := workflows2[0]["workflow_uuid"].(string)
257-
require.True(t, ok, "workflow_uuid should be a string")
256+
id2, ok := workflows2[0]["WorkflowUUID"].(string)
257+
require.True(t, ok, "WorkflowUUID should be a string")
258258
assert.Equal(t, workflowID2, id2, "Expected second workflow ID in results")
259259

260260
// Also test end_time filter
@@ -280,8 +280,8 @@ func TestAdminServer(t *testing.T) {
280280
assert.Equal(t, 1, len(workflows3), "Expected exactly 1 workflow with end_time before timeBetween")
281281

282282
// Verify it's the first workflow
283-
id3, ok := workflows3[0]["workflow_uuid"].(string)
284-
require.True(t, ok, "workflow_uuid should be a string")
283+
id3, ok := workflows3[0]["WorkflowUUID"].(string)
284+
require.True(t, ok, "WorkflowUUID should be a string")
285285
assert.Equal(t, workflowID1, id3, "Expected first workflow ID in results")
286286

287287
// Test 4: Query with empty body (should return all workflows)
@@ -304,8 +304,8 @@ func TestAdminServer(t *testing.T) {
304304
// Verify both workflow IDs are present
305305
foundIDs4 := make(map[string]bool)
306306
for _, wf := range workflows4 {
307-
id, ok := wf["workflow_uuid"].(string)
308-
require.True(t, ok, "workflow_uuid should be a string")
307+
id, ok := wf["WorkflowUUID"].(string)
308+
require.True(t, ok, "WorkflowUUID should be a string")
309309
foundIDs4[id] = true
310310
}
311311
assert.True(t, foundIDs4[workflowID1], "Expected to find first workflow ID in empty body results")

0 commit comments

Comments
 (0)