Skip to content

Commit b608765

Browse files
committed
fix: missing model partial things
1 parent fb43775 commit b608765

33 files changed

Lines changed: 143 additions & 117 deletions

apps/backend/src/routes/auth.http.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ const makeJwt = (exp: number = Math.floor(Date.now() / 1000) + 3600) => {
5151
return `${encode({ alg: "none", typ: "JWT" })}.${encode({ exp, sid: "session_test_123" })}.`
5252
}
5353

54-
const makeUserRecord = (overrides: Partial<Schema.Schema.Type<typeof User.Schema>> = {}) =>
54+
const makeUserRecord = (
55+
overrides: Partial<Schema.Schema.Type<typeof User.Schema> & { externalId: string }> = {},
56+
) =>
5557
({
5658
id: "usr_default123" as UserId,
5759
externalId: "user_default",

libs/bot-sdk/src/hazel-bot-sdk.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,9 +1379,6 @@ export class HazelBotClient extends ServiceMap.Service<HazelBotClient>()("HazelB
13791379
) =>
13801380
rpc["channel.update"]({
13811381
id: channel.id,
1382-
type: channel.type,
1383-
organizationId: channel.organizationId,
1384-
parentChannelId: channel.parentChannelId,
13851382
name: updates.name ?? channel.name,
13861383
...updates,
13871384
}).pipe(

packages/domain/src/models/attachment-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Model extends M.Class<Model>("Attachment")({
1414
fileName: S.String,
1515
fileSize: S.Number,
1616
externalUrl: S.NullOr(S.String),
17-
uploadedBy: M.GeneratedByApp(UserId),
17+
uploadedBy: M.Immutable(UserId),
1818
status: AttachmentStatus,
1919
uploadedAt: JsonDate,
2020
deletedAt: M.Generated(S.NullOr(JsonDate)),

packages/domain/src/models/bot-model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import { baseFields, JsonDate } from "./utils"
66

77
class Model extends M.Class<Model>("Bot")({
88
id: M.Generated(BotId),
9-
userId: UserId,
10-
createdBy: UserId,
9+
userId: M.Immutable(UserId),
10+
createdBy: M.Immutable(UserId),
1111
name: S.String,
1212
description: S.NullOr(S.String),
1313
webhookUrl: S.NullOr(S.String),
14-
apiTokenHash: S.String,
14+
apiTokenHash: M.Sensitive(S.String),
1515
scopes: S.NullOr(S.Array(S.String)),
1616
metadata: S.NullOr(S.Record(S.String, S.Unknown)),
1717
isPublic: S.Boolean,
18-
installCount: S.Number,
18+
installCount: M.GeneratedByApp(S.Number),
1919
// List of integration providers this bot is allowed to use (e.g., ["linear", "github"])
2020
allowedIntegrations: S.NullOr(S.Array(IntegrationProvider)),
2121
// Whether this bot can be @mentioned in messages

packages/domain/src/models/channel-member-model.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import { JsonDate } from "./utils"
55

66
class Model extends M.Class<Model>("ChannelMember")({
77
id: M.Generated(ChannelMemberId),
8-
channelId: ChannelId,
9-
userId: M.GeneratedByApp(UserId),
8+
channelId: M.Immutable(ChannelId),
9+
userId: M.Immutable(UserId),
1010
isHidden: S.Boolean,
1111
isMuted: S.Boolean,
1212
isFavorite: S.Boolean,
1313
lastSeenMessageId: S.NullOr(MessageId),
14-
notificationCount: S.Number,
15-
joinedAt: M.GeneratedByApp(JsonDate),
14+
notificationCount: M.GeneratedByApp(S.Number),
15+
joinedAt: M.Immutable(JsonDate),
1616
createdAt: M.Generated(JsonDate),
1717
deletedAt: M.GeneratedByApp(S.NullOr(JsonDate)),
1818
}) {}
1919

20-
export const { Insert, Update, Schema, Create, Patch } = M.expose(Model)
20+
export const { Insert, Update, Schema, Create, Patch, PatchPartial } = M.expose(Model)
2121
export type Type = typeof Schema.Type

packages/domain/src/models/channel-model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ class Model extends M.Class<Model>("Channel")({
1010
id: M.GeneratedOptional(ChannelId),
1111
name: S.String,
1212
icon: S.NullOr(ChannelIcon),
13-
type: ChannelType,
14-
organizationId: OrganizationId,
15-
parentChannelId: S.NullOr(ChannelId),
13+
type: M.Immutable(ChannelType),
14+
organizationId: M.Immutable(OrganizationId),
15+
parentChannelId: M.Immutable(S.NullOr(ChannelId)),
1616
sectionId: S.NullOr(ChannelSectionId),
1717
...baseFields,
1818
}) {}
1919

20-
export const { Insert, Update, Schema, Create, Patch } = M.expose(Model)
20+
export const { Insert, Update, Schema, Create, Patch, PatchPartial } = M.expose(Model)
2121
export type Type = typeof Schema.Type

packages/domain/src/models/channel-section-model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { baseFields } from "./utils"
55

66
class Model extends M.Class<Model>("ChannelSection")({
77
id: M.GeneratedOptional(ChannelSectionId),
8-
organizationId: OrganizationId,
8+
organizationId: M.Immutable(OrganizationId),
99
name: S.String,
1010
order: S.Number,
1111
...baseFields,
1212
}) {}
1313

14-
export const { Insert, Update, Schema, Create, Patch } = M.expose(Model)
14+
export const { Insert, Update, Schema, Create, Patch, PatchPartial } = M.expose(Model)
1515
export type Type = typeof Schema.Type

packages/domain/src/models/chat-sync-connection-model.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ export type ChatSyncConnectionStatus = S.Schema.Type<typeof ChatSyncConnectionSt
1111

1212
class Model extends M.Class<Model>("ChatSyncConnection")({
1313
id: M.Generated(SyncConnectionId),
14-
organizationId: OrganizationId,
15-
integrationConnectionId: S.NullOr(IntegrationConnectionId),
16-
provider: ChatSyncProvider,
17-
externalWorkspaceId: S.String,
18-
externalWorkspaceName: S.NullOr(S.String),
14+
organizationId: M.Immutable(OrganizationId),
15+
integrationConnectionId: M.Immutable(S.NullOr(IntegrationConnectionId)),
16+
provider: M.Immutable(ChatSyncProvider),
17+
externalWorkspaceId: M.Immutable(S.String),
18+
externalWorkspaceName: M.GeneratedByApp(S.NullOr(S.String)),
1919
status: ChatSyncConnectionStatus,
2020
settings: S.NullOr(S.Record(S.String, S.Unknown)),
2121
metadata: S.NullOr(S.Record(S.String, S.Unknown)),
22-
errorMessage: S.NullOr(S.String),
23-
lastSyncedAt: S.NullOr(JsonDate),
24-
createdBy: UserId,
22+
errorMessage: M.GeneratedByApp(S.NullOr(S.String)),
23+
lastSyncedAt: M.GeneratedByApp(S.NullOr(JsonDate)),
24+
createdBy: M.Immutable(UserId),
2525
createdAt: M.Generated(JsonDate),
2626
updatedAt: M.Generated(S.NullOr(JsonDate)),
2727
deletedAt: M.GeneratedByApp(S.NullOr(JsonDate)),

packages/domain/src/models/connect-conversation-model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ export type ConnectConversationStatus = S.Schema.Type<typeof ConnectConversation
88

99
class Model extends M.Class<Model>("ConnectConversation")({
1010
id: M.Generated(ConnectConversationId),
11-
hostOrganizationId: OrganizationId,
12-
hostChannelId: ChannelId,
13-
status: ConnectConversationStatus,
11+
hostOrganizationId: M.Immutable(OrganizationId),
12+
hostChannelId: M.Immutable(ChannelId),
13+
status: M.GeneratedByApp(ConnectConversationStatus),
1414
settings: S.NullOr(S.Record(S.String, S.Unknown)),
15-
createdBy: UserId,
15+
createdBy: M.Immutable(UserId),
1616
createdAt: M.Generated(JsonDate),
1717
updatedAt: M.Generated(S.NullOr(JsonDate)),
1818
deletedAt: M.GeneratedByApp(S.NullOr(JsonDate)),

packages/domain/src/models/custom-emoji-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Model extends M.Class<Model>("CustomEmoji")({
88
organizationId: OrganizationId,
99
name: S.String,
1010
imageUrl: S.String,
11-
createdBy: M.GeneratedByApp(UserId),
11+
createdBy: M.Immutable(UserId),
1212
createdAt: M.Generated(JsonDate),
1313
updatedAt: M.Generated(S.NullOr(JsonDate)),
1414
deletedAt: M.Generated(S.NullOr(JsonDate)),

0 commit comments

Comments
 (0)