Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into ocrvs-6213
Browse files Browse the repository at this point in the history
  • Loading branch information
jamil314 committed Jan 3, 2025
2 parents c858385 + 2a80871 commit 8a0b37d
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 264 deletions.
7 changes: 3 additions & 4 deletions packages/commons/src/events/ActionDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { z } from 'zod'
const ActionBase = z.object({
createdAt: z.string().datetime(),
createdBy: z.string(),
createdAtLocation: z.string(),
data: z.record(z.string(), z.any())
})

Expand Down Expand Up @@ -60,15 +61,13 @@ const DraftAction = ActionBase.merge(

const CreatedAction = ActionBase.merge(
z.object({
type: z.literal(ActionType.CREATE),
createdAtLocation: z.string()
type: z.literal(ActionType.CREATE)
})
)

const NotifiedAction = ActionBase.merge(
z.object({
type: z.literal(ActionType.NOTIFY),
createdAtLocation: z.string()
type: z.literal(ActionType.NOTIFY)
})
)

Expand Down
12 changes: 8 additions & 4 deletions packages/events/src/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,22 @@ export const appRouter = router({
notify: publicProcedure.input(NotifyActionInput).mutation((options) => {
return addAction(options.input, {
eventId: options.input.eventId,
createdBy: options.ctx.user.id
createdBy: options.ctx.user.id,
createdAtLocation: options.ctx.user.primaryOfficeId
})
}),
draft: publicProcedure.input(DraftActionInput).mutation((options) => {
return addAction(options.input, {
eventId: options.input.eventId,
createdBy: options.ctx.user.id
createdBy: options.ctx.user.id,
createdAtLocation: options.ctx.user.primaryOfficeId
})
}),
declare: publicProcedure.input(DeclareActionInput).mutation((options) => {
return addAction(options.input, {
eventId: options.input.eventId,
createdBy: options.ctx.user.id
createdBy: options.ctx.user.id,
createdAtLocation: options.ctx.user.primaryOfficeId
})
}),
register: publicProcedure
Expand All @@ -140,7 +143,8 @@ export const appRouter = router({
},
{
eventId: options.input.eventId,
createdBy: options.ctx.user.id
createdBy: options.ctx.user.id,
createdAtLocation: options.ctx.user.primaryOfficeId
}
)
})
Expand Down
9 changes: 7 additions & 2 deletions packages/events/src/service/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ export async function createEvent({

export async function addAction(
input: ActionInput,
{ eventId, createdBy }: { eventId: string; createdBy: string }
{
eventId,
createdBy,
createdAtLocation
}: { eventId: string; createdBy: string; createdAtLocation: string }
) {
const db = await getClient()
const now = new Date().toISOString()
Expand All @@ -115,7 +119,8 @@ export async function addAction(
actions: {
...input,
createdBy,
createdAt: now
createdAt: now,
createdAtLocation
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions packages/gateway/src/graphql/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import {
} from 'graphql'

import { ApolloServerOptions } from '@apollo/server'
import { resolvers as eventsV2Resolvers } from '@gateway/v2-events/events/root-resolvers'
import { eventResolvers as eventsV2TypeResolvers } from '@gateway/v2-events/events/type-resolvers'
import { resolvers as bookmarkAdvancedSearchResolvers } from '@gateway/features/bookmarkAdvancedSearch/root-resolvers'
import { resolvers as correctionRootResolvers } from '@gateway/features/correction/root-resolvers'
import { resolvers as locationRootResolvers } from '@gateway/features/location/root-resolvers'
Expand Down Expand Up @@ -61,8 +59,6 @@ interface IStringIndexSignatureInterface {
type StringIndexed<T> = T & IStringIndexSignatureInterface

export const resolvers: StringIndexed<IResolvers> = merge(
eventsV2Resolvers,
eventsV2TypeResolvers,
notificationRootResolvers as IResolvers,
registrationRootResolvers as IResolvers,
locationRootResolvers as IResolvers,
Expand Down
2 changes: 0 additions & 2 deletions packages/gateway/src/graphql/index.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# import Mutation.* from '../features/systems/schema.graphql'
# import Query.* from '../features/systems/schema.graphql'
# import Mutation from '../features/bookmarkAdvancedSearch/schema.graphql'
# import Mutation.* from '../v2-events/events/schema.graphql'
# import Query.* from '../v2-events/events/schema.graphql'
# import * from 'common.graphql'

# TODO
Expand Down
57 changes: 0 additions & 57 deletions packages/gateway/src/v2-events/events/root-resolvers.ts

This file was deleted.

149 changes: 0 additions & 149 deletions packages/gateway/src/v2-events/events/schema.graphql

This file was deleted.

42 changes: 0 additions & 42 deletions packages/gateway/src/v2-events/events/type-resolvers.ts

This file was deleted.

0 comments on commit 8a0b37d

Please sign in to comment.