Skip to content

Commit 0a69627

Browse files
committed
drop null from 4.4.1
1 parent 8040add commit 0a69627

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

pdd/001-infra-rollout-4.4.1.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This document details the technical design for the API and backend components of
2828
"message": string | undefined
2929
}
3030
```
31-
* **Default Value (for the column in DB):** `{"enabled": false, "message": null}`
31+
* **Default Value (for the column in DB):** `{"enabled": false, "message": undefined}`
3232
* **Nullable (column itself):** `false` (the column should always exist, its content defines state).
3333
* **Migration:** A TypeORM migration script will be generated and applied to add this column with its default value.
3434

@@ -53,14 +53,14 @@ This document details the technical design for the API and backend components of
5353
message GetScheduledMaintenanceNotificationResponse {
5454
bool is_enabled = 1;
5555
string message = 2; // The custom message stored, if any. Empty or not present if no custom message is set.
56-
// The frontend will use its own default if this is empty/null and is_enabled is true.
56+
// The frontend will use its own default if this is empty/undefined and is_enabled is true.
5757
}
5858

5959
message SetScheduledMaintenanceNotificationRequest {
6060
string organization_id = 1;
6161
bool is_enabled = 2;
6262
optional string custom_message = 3; // User-provided custom message.
63-
// If not provided or empty, the backend stores null/empty for the message.
63+
// If not provided or empty, the backend stores undefined/empty for the message.
6464
}
6565

6666
message SetScheduledMaintenanceNotificationResponse {
@@ -75,9 +75,9 @@ This document details the technical design for the API and backend components of
7575
* **`getScheduledMaintenanceNotification` Implementation:**
7676
* Input: `GetScheduledMaintenanceNotificationRequest`.
7777
* Calls `this.orgService.getScheduledMaintenanceNotificationSettings(ctxUserId(), req.organizationId)`.
78-
* Maps the internal result (e.g., `{ enabled: boolean, message: string | null }`) to `GetScheduledMaintenanceNotificationResponse`.
78+
* Maps the internal result (e.g., `{ enabled: boolean, message: string | undefined }`) to `GetScheduledMaintenanceNotificationResponse`.
7979
* `response.is_enabled = internalResult.enabled;`
80-
* `response.message = internalResult.message || "";` (Return empty string if message is null).
80+
* `response.message = internalResult.message || "";` (Return empty string if message is undefined).
8181
* **`setScheduledMaintenanceNotification` Implementation:**
8282
* Input: `SetScheduledMaintenanceNotificationRequest`.
8383
* Calls `this.orgService.setScheduledMaintenanceNotificationSettings(ctxUserId(), req.organizationId, req.isEnabled, req.customMessage)`.
@@ -100,11 +100,11 @@ This document details the technical design for the API and backend components of
100100
* Fetch `DBTeam` by `orgId` using `this.teamDB.findTeamById(orgId)`.
101101
* If not found, throw `ApplicationError(ErrorCodes.NOT_FOUND)`.
102102
* Let `dbNotificationConfig = team.maintenanceNotification;`
103-
* If `dbNotificationConfig` is null or parsing fails (though TypeORM usually handles JSON column parsing):
103+
* If `dbNotificationConfig` is undefined or parsing fails (though TypeORM usually handles JSON column parsing):
104104
* Return `{ enabled: false, message: undefined }`.
105105
* Else (valid JSON from DB):
106-
* Return `{ enabled: dbNotificationConfig.enabled, message: dbNotificationConfig.message === null ? undefined : dbNotificationConfig.message }`.
107-
* **`setScheduledMaintenanceNotificationSettings(userId: string, orgId: string, isEnabled: boolean, customMessage?: string | null): Promise<MaintenanceNotificationSettings>` method:**
106+
* Return `{ enabled: dbNotificationConfig.enabled, message: dbNotificationConfig.message }`.
107+
* **`setScheduledMaintenanceNotificationSettings(userId: string, orgId: string, isEnabled: boolean, customMessage?: string | undefined): Promise<MaintenanceNotificationSettings>` method:**
108108
* Authorization: `await this.auth.checkPermissionOnOrganization(userId, "maintenance", orgId);`.
109109
* Logic:
110110
* Fetch `DBTeam`. If not found, throw `ApplicationError(ErrorCodes.NOT_FOUND)`.
@@ -115,11 +115,11 @@ This document details the technical design for the API and backend components of
115115
message: (customMessage && customMessage.trim() !== "") ? customMessage.trim() : undefined,
116116
};
117117
```
118-
* Prepare the object to be stored in the DB (JSON will store `null` for `undefined` message):
118+
* Prepare the object to be stored in the DB:
119119
```typescript
120120
const notificationConfigForDb = {
121121
enabled: newInternalNotificationConfig.enabled,
122-
message: newInternalNotificationConfig.message === undefined ? null : newInternalNotificationConfig.message,
122+
message: newInternalNotificationConfig.message,
123123
};
124124
```
125125
* Prepare update payload for `this.teamDB.updateTeam(orgId, updatePayload)`:
@@ -148,6 +148,5 @@ This document details the technical design for the API and backend components of
148148
* If more detailed `DbAuditLog` entries are required (e.g., logging the actual message content changes), they can be added within the `setScheduledMaintenanceNotificationSettings` method in `OrganizationService`.
149149

150150
## 5. Open Questions / Considerations (Backend Specific)
151-
* Ensuring the default value for the `maintenanceNotification` JSON column (`{"enabled": false, "message": null}`) is correctly applied by the migration and handled if the column is ever unexpectedly null.
152151
* Error handling during JSON parsing from the DB (though TypeORM typically handles this well for JSON columns).
153-
* The `message` field in `GetScheduledMaintenanceNotificationResponse` and `SetScheduledMaintenanceNotificationResponse` will be an empty string if no custom message is set (i.e., `null` in the DB). The frontend will be responsible for interpreting this as "use frontend default".
152+
* The `message` field in `GetScheduledMaintenanceNotificationResponse` and `SetScheduledMaintenanceNotificationResponse` will be an empty string if no custom message is set. The frontend will be responsible for interpreting this as "use frontend default".

0 commit comments

Comments
 (0)