Skip to content

Commit

Permalink
feat: Return IDs in workflow response
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmichaelchen committed Jan 5, 2024
1 parent e70c5de commit 4f70051
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 23 deletions.
6 changes: 5 additions & 1 deletion cmd/saga/start/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func (s *Service) CreateOnboardingWorkflow(

orgID := uuid.New().String()
profileID := uuid.New().String()
licenseID := uuid.New().String()

args := saga.CreateLicenseInputArgs{
Org: saga.Org{
Expand All @@ -67,7 +68,7 @@ func (s *Service) CreateOnboardingWorkflow(
FullName: req.Msg.GetProfile().GetFullName(),
},
License: saga.License{
ID: uuid.New().String(),
ID: licenseID,
Start: req.Msg.GetLicense().GetStart().AsTime(),
End: req.Msg.GetLicense().GetEnd().AsTime(),
UserID: profileID,
Expand All @@ -88,6 +89,9 @@ func (s *Service) CreateOnboardingWorkflow(

res := &temporalPB.CreateOnboardingWorkflowResponse{
WorkflowId: workflow.GetID(),
OrgId: orgID,
ProfileId: profileID,
LicenseId: licenseID,
}

out := connect.NewResponse(res)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ require (
buf.build/gen/go/kevinmichaelchen/orgapis/protocolbuffers/go v1.32.0-20240105230936-cc69561a5883.1
buf.build/gen/go/kevinmichaelchen/profileapis/connectrpc/go v1.14.0-20240105230937-9f5a2b967cc7.1
buf.build/gen/go/kevinmichaelchen/profileapis/protocolbuffers/go v1.32.0-20240105230937-9f5a2b967cc7.1
buf.build/gen/go/kevinmichaelchen/temporalapis/connectrpc/go v1.14.0-20240105224636-721997cf176e.1
buf.build/gen/go/kevinmichaelchen/temporalapis/protocolbuffers/go v1.32.0-20240105224636-721997cf176e.1
buf.build/gen/go/kevinmichaelchen/temporalapis/connectrpc/go v1.14.0-20240105233422-8054bf72d102.1
buf.build/gen/go/kevinmichaelchen/temporalapis/protocolbuffers/go v1.32.0-20240105233422-8054bf72d102.1
connectrpc.com/connect v1.14.0
connectrpc.com/grpchealth v1.3.0
connectrpc.com/grpcreflect v1.2.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ buf.build/gen/go/kevinmichaelchen/profileapis/connectrpc/go v1.14.0-202401052309
buf.build/gen/go/kevinmichaelchen/profileapis/connectrpc/go v1.14.0-20240105230937-9f5a2b967cc7.1/go.mod h1:yZWWCij9/6ffN2PJwEYWgs7DjkWa5cXl2AR8Xvnc+Ng=
buf.build/gen/go/kevinmichaelchen/profileapis/protocolbuffers/go v1.32.0-20240105230937-9f5a2b967cc7.1 h1:YaUHKKR7AZRrnCiZ+QOQuw2wQB0DlOe8KBdN7bDymhs=
buf.build/gen/go/kevinmichaelchen/profileapis/protocolbuffers/go v1.32.0-20240105230937-9f5a2b967cc7.1/go.mod h1:mdFxPRDe6P7qFVw9urFLZ3SkG+ZdPW5q5QXFGjGr8DE=
buf.build/gen/go/kevinmichaelchen/temporalapis/connectrpc/go v1.14.0-20240105224636-721997cf176e.1 h1:JRUSsAPd9V5UQFPYs1dckEwRS0R/bAQtCRlRRQ+n9Pw=
buf.build/gen/go/kevinmichaelchen/temporalapis/connectrpc/go v1.14.0-20240105224636-721997cf176e.1/go.mod h1:2PeRAbDFPMunT2xjMRMjvkzCGgilVlNWYwgYRatp3/4=
buf.build/gen/go/kevinmichaelchen/temporalapis/protocolbuffers/go v1.32.0-20240105224636-721997cf176e.1 h1:3dN5NHBYnXnHPa2qG22eeVYNG/ZwAni9potlZz6XcNA=
buf.build/gen/go/kevinmichaelchen/temporalapis/protocolbuffers/go v1.32.0-20240105224636-721997cf176e.1/go.mod h1:2Mpji+rUNpkV7r9a5cIDXpKJMRYmp0I0XrM61EBLEDY=
buf.build/gen/go/kevinmichaelchen/temporalapis/connectrpc/go v1.14.0-20240105233422-8054bf72d102.1 h1:DjZa2Ji1Rje54fcm1SU2EfRRyEwfHNrt1SIz2JxaFMA=
buf.build/gen/go/kevinmichaelchen/temporalapis/connectrpc/go v1.14.0-20240105233422-8054bf72d102.1/go.mod h1:lAv2Uero9GS0WGHvco9tw82GY5J/U0uuBdccsHV4Acc=
buf.build/gen/go/kevinmichaelchen/temporalapis/protocolbuffers/go v1.32.0-20240105233422-8054bf72d102.1 h1:TOugHIye1MzyV7Vjzff13UZWidUVPp0xwmejtOBEXew=
buf.build/gen/go/kevinmichaelchen/temporalapis/protocolbuffers/go v1.32.0-20240105233422-8054bf72d102.1/go.mod h1:2Mpji+rUNpkV7r9a5cIDXpKJMRYmp0I0XrM61EBLEDY=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
Expand Down
Binary file modified ui/bun.lockb
Binary file not shown.
32 changes: 17 additions & 15 deletions ui/src/app/dashboard/actions.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
'use server'
"use server";

import { Timestamp } from '@bufbuild/protobuf'
import { createPromiseClient } from '@connectrpc/connect'
import { TemporalService } from '@buf/kevinmichaelchen_temporalapis.connectrpc_es/temporal/v1beta1/api_connect'
import { createConnectTransport } from '@connectrpc/connect-web'
import { Timestamp } from "@bufbuild/protobuf";
import { createPromiseClient } from "@connectrpc/connect";
import { TemporalService } from "@buf/kevinmichaelchen_temporalapis.connectrpc_es/temporal/v1beta1/api_connect";
import { createConnectTransport } from "@connectrpc/connect-web";

const temporalClient = createPromiseClient(
TemporalService,
createConnectTransport({
baseUrl: 'http://localhost:8081',
baseUrl: "http://localhost:8081",
}),
)
);

export async function createOnboardingWorkflow({
orgName,
profileName,
start,
end,
}: {
orgName: string
profileName: string
start: Date
end: Date
orgName: string;
profileName: string;
start: Date;
end: Date;
}) {
'use server'
"use server";
const response = await temporalClient.createOnboardingWorkflow({
org: {
name: orgName,
Expand All @@ -33,8 +33,10 @@ export async function createOnboardingWorkflow({
end: Timestamp.fromDate(end),
},
profile: {
name: profileName,
fullName: profileName,
},
})
return response
});

// TODO it's complaining we can't pass a RSC object to a CC object
return response.toJson();
}
2 changes: 1 addition & 1 deletion ui/src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function CreateWorkflowDialog() {
start: values.startDate,
end: values.endDate,
});
toast(response.toJsonString());
toast(JSON.stringify(response));
}

return (
Expand Down

0 comments on commit 4f70051

Please sign in to comment.