4591 - Original Data Point Comments Separation - Activity logs - #5218
Conversation
| export const ODP_COMMENT_COLUMN_EXTENT = `comments_${TableNames.extentOfForest.toLocaleLowerCase()}` | ||
| export const ODP_COMMENT_COLUMN_FOREST_CHARACTERISTICS = `comments_${TableNames.forestCharacteristics.toLocaleLowerCase()}` |
There was a problem hiding this comment.
better a Record and in src/server/db/repository/assessmentCycle/originalDataPoint since they are used only there?
| const message = | ||
| field === TableNames.extentOfForest | ||
| ? ActivityLogMessage.originalDataPointUpdateCommentExtentOfForest | ||
| : ActivityLogMessage.originalDataPointUpdateCommentForestCharacteristics | ||
|
|
| user: User | ||
| } | ||
|
|
||
| const ACTIVITY_LOG_MESSAGE_BY_FIELD: Record<OriginalDataPointCommentKey, ActivityLogMessage> = { |
| import { OriginalDataPoint, OriginalDataPointComments } from 'meta/assessment/originalDataPoint' | ||
| import { TableNames } from 'meta/assessment/table' | ||
|
|
||
| import { ODP_COMMENT_COLUMNS_RECORD } from 'server/repository/assessmentCycle/originalDataPoint/commentColumns' |
|
|
||
| import { ODP_COMMENT_COLUMNS_RECORD } from 'server/repository/assessmentCycle/originalDataPoint/commentColumns' | ||
|
|
||
| type OriginalDataPointDB = Record<string, unknown> |
There was a problem hiding this comment.
this must specify the columns
| }) | ||
|
|
||
| if (!hasForestCharacteristicsComments) { | ||
| await DB.none(`alter table ${tableName} add column ${commentColumnForestCharacteristics} text`) |
There was a problem hiding this comment.
by default comments should be empty string.
DDL is missing
| if (!Objects.isNil(commentsExtentOfForest)) { | ||
| comments[TableNames.extentOfForest] = commentsExtentOfForest as string | ||
| } | ||
|
|
||
| if (!Objects.isNil(commentsForestCharacteristics)) { | ||
| comments[TableNames.forestCharacteristics] = commentsForestCharacteristics as string | ||
| } |
There was a problem hiding this comment.
by default these values should not be null
| export { ColAdapter } from './col' | ||
| export type { FileDB } from './file' | ||
| export { FileAdapter } from './file' | ||
| export { OriginalDataPointAdapter } from './originalDataPoint' |
There was a problem hiding this comment.
lets start not exporting from barrel files
| ] as ODPCommentColName<TableNames.forestCharacteristics> | ||
|
|
||
| export const OriginalDataPointAdapter = (row: OriginalDataPointDB): OriginalDataPoint => { | ||
| if (Objects.isNil(row)) return null |
There was a problem hiding this comment.
It can be null when a query returns no rows, so some tests fail without this check
There was a problem hiding this comment.
Strange . Which query ? Do we use oneRoNone or map ?
There was a problem hiding this comment.
Let's check this in the next pr @yaguzmang we merge this now . It was too big this pr to handle it properly
c91be1e
into
4591-original-data-point---comments-area-separation-for-1a-and-1b
No description provided.