Skip to content

Commit

Permalink
Merge branch 'chore/ReflectPrompt-phase1' into chore/ReflectPrompt-ph…
Browse files Browse the repository at this point in the history
…ase2
  • Loading branch information
mattkrick committed Sep 10, 2024
2 parents a38beb4 + 21fc97c commit d18a710
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions packages/server/database/types/RetrospectivePrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface Input {
description: string
groupColor: string
removedAt: Date | null
parentPromptId?: string
parentPromptId?: string | null
}

export default class RetrospectivePrompt {
Expand All @@ -22,7 +22,7 @@ export default class RetrospectivePrompt {
question: string
removedAt: Date | null
updatedAt = new Date()
parentPromptId?: string
parentPromptId?: string | null

constructor(input: Input) {
const {
Expand All @@ -43,6 +43,6 @@ export default class RetrospectivePrompt {
this.description = description || ''
this.groupColor = groupColor
this.removedAt = removedAt
this.parentPromptId = parentPromptId
this.parentPromptId = parentPromptId || null
}
}
12 changes: 8 additions & 4 deletions packages/server/graphql/mutations/updateTemplateScope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {RDatum} from '../../database/stricterR'
import {SharingScopeEnum as ESharingScope} from '../../database/types/MeetingTemplate'
import PokerTemplate from '../../database/types/PokerTemplate'
import ReflectTemplate from '../../database/types/ReflectTemplate'
import RetrospectivePrompt from '../../database/types/RetrospectivePrompt'
import generateUID from '../../generateUID'
import getKysely from '../../postgres/getKysely'
import {analytics} from '../../utils/analytics/analytics'
Expand Down Expand Up @@ -89,12 +88,17 @@ const updateTemplateScope = {
const activePrompts = prompts.filter(({removedAt}) => !removedAt)
const promptIds = activePrompts.map(({id}) => id)
const clonedPrompts = activePrompts.map((prompt) => {
return new RetrospectivePrompt({
...prompt,
return {
id: generateUID(),
teamId: prompt.teamId,
templateId: clonedTemplateId!,
parentPromptId: prompt.id,
sortOrder: prompt.sortOrder,
question: prompt.question,
description: prompt.description,
groupColor: prompt.groupColor,
removedAt: null
})
}
})
await Promise.all([
pg
Expand Down
3 changes: 1 addition & 2 deletions packages/server/graphql/public/types/ReflectPhase.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import MeetingRetrospective from '../../../database/types/MeetingRetrospective'
import RetrospectivePrompt from '../../../database/types/RetrospectivePrompt'
import {ReflectPhaseResolvers} from '../resolverTypes'

const ReflectPhase: ReflectPhaseResolvers = {
Expand All @@ -15,7 +14,7 @@ const ReflectPhase: ReflectPhaseResolvers = {
// only show prompts that were created before the meeting and
// either have not been removed or they were removed after the meeting was created
return prompts.filter(
(prompt: RetrospectivePrompt) =>
(prompt) =>
prompt.createdAt < meeting.createdAt &&
(!prompt.removedAt || meeting.createdAt < prompt.removedAt)
)
Expand Down

0 comments on commit d18a710

Please sign in to comment.