Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(comments): update comments module to typescript #2513

Merged
merged 9 commits into from
Aug 21, 2024

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/server/modules/comments/helpers/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DataStruct, LegacyData } from '@/modules/comments/services/data'
import { SmartTextEditorValueSchema } from '@/modules/core/services/richTextEditorService'
import { Nullable } from '@/modules/shared/helpers/typeHelper'

export type CommentLinkResourceType = 'stream' | 'commit' | 'object' | 'comment'
Expand All @@ -9,7 +10,7 @@ export interface CommentRecord {
authorId: string
createdAt: Date
updatedAt: Date
text: Nullable<string>
text: Nullable<string | SmartTextEditorValueSchema>
screenshot: Nullable<string>
data: Nullable<LegacyData | DataStruct>
archived: boolean
Expand Down
19 changes: 0 additions & 19 deletions packages/server/modules/comments/index.js

This file was deleted.

22 changes: 22 additions & 0 deletions packages/server/modules/comments/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { moduleLogger } from '@/logging/logging'
iainsproat marked this conversation as resolved.
Show resolved Hide resolved
import { notifyUsersOnCommentEvents } from '@/modules/comments/services/notifications'
import { Optional, SpeckleModule } from '@/modules/shared/helpers/typeHelper'

let unsubFromEvents: Optional<() => void> = undefined

const commentsModule: SpeckleModule = {
async init(_, isInitial) {
moduleLogger.info('🗣 Init comments module')

if (isInitial) {
unsubFromEvents = await notifyUsersOnCommentEvents()
}
},
async finalize() {},
async shutdown() {
unsubFromEvents?.()
unsubFromEvents = undefined
}
}

export = commentsModule
10 changes: 5 additions & 5 deletions packages/server/modules/comments/repositories/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,15 +466,15 @@ export type PaginatedProjectCommentsParams = {
cursor?: MaybeNullOrUndefined<string>
filter?: MaybeNullOrUndefined<
Partial<{
threadsOnly: boolean
includeArchived: boolean
archivedOnly: boolean
resourceIdString: string
threadsOnly: boolean | null
includeArchived: boolean | null
archivedOnly: boolean | null
resourceIdString: string | null
/**
* If true, will ignore the version parts of `model@version` identifiers and look for comments of
* all versions of any selected comments
*/
allModelVersions: boolean
allModelVersions: boolean | null
}>
>
}
Expand Down
Loading