11import { relations } from "drizzle-orm/relations" ;
22import {
33 neptunUser ,
4- chatConversation ,
54 neptunUserOauthAccount ,
65 chatConversationMessage ,
6+ chatConversation ,
77 chatConversationFile ,
88 neptunUserFile ,
99 githubAppInstallation ,
@@ -21,25 +21,21 @@ import {
2121 chatConversationShareWhitelistEntry ,
2222} from "./schema.js" ;
2323
24- export const chatConversationRelations = relations (
25- chatConversation ,
26- ( { one, many } ) => ( {
24+ export const neptunUserOauthAccountRelations = relations (
25+ neptunUserOauthAccount ,
26+ ( { one } ) => ( {
2727 neptunUser : one ( neptunUser , {
28- fields : [ chatConversation . neptunUserId ] ,
28+ fields : [ neptunUserOauthAccount . neptunUserId ] ,
2929 references : [ neptunUser . id ] ,
3030 } ) ,
31- chatConversationMessages : many ( chatConversationMessage ) ,
32- chatConversationFiles : many ( chatConversationFile ) ,
33- projectChatConversations : many ( projectChatConversation ) ,
34- chatConversationShares : many ( chatConversationShare ) ,
3531 } ) ,
3632) ;
3733
3834export const neptunUserRelations = relations ( neptunUser , ( { many } ) => ( {
39- chatConversations : many ( chatConversation ) ,
4035 neptunUserOauthAccounts : many ( neptunUserOauthAccount ) ,
4136 chatConversationMessages : many ( chatConversationMessage ) ,
4237 chatConversationFiles : many ( chatConversationFile ) ,
38+ chatConversations : many ( chatConversation ) ,
4339 githubAppInstallations : many ( githubAppInstallation ) ,
4440 neptunContextFiles : many ( neptunContextFile ) ,
4541 neptunContextImports : many ( neptunContextImport ) ,
@@ -52,16 +48,6 @@ export const neptunUserRelations = relations(neptunUser, ({ many }) => ({
5248 ) ,
5349} ) ) ;
5450
55- export const neptunUserOauthAccountRelations = relations (
56- neptunUserOauthAccount ,
57- ( { one } ) => ( {
58- neptunUser : one ( neptunUser , {
59- fields : [ neptunUserOauthAccount . neptunUserId ] ,
60- references : [ neptunUser . id ] ,
61- } ) ,
62- } ) ,
63- ) ;
64-
6551export const chatConversationMessageRelations = relations (
6652 chatConversationMessage ,
6753 ( { one, many } ) => ( {
@@ -77,6 +63,20 @@ export const chatConversationMessageRelations = relations(
7763 } ) ,
7864) ;
7965
66+ export const chatConversationRelations = relations (
67+ chatConversation ,
68+ ( { one, many } ) => ( {
69+ chatConversationMessages : many ( chatConversationMessage ) ,
70+ chatConversationFiles : many ( chatConversationFile ) ,
71+ neptunUser : one ( neptunUser , {
72+ fields : [ chatConversation . neptunUserId ] ,
73+ references : [ neptunUser . id ] ,
74+ } ) ,
75+ projectChatConversations : many ( projectChatConversation ) ,
76+ chatConversationShares : many ( chatConversationShare ) ,
77+ } ) ,
78+ ) ;
79+
8080export const chatConversationFileRelations = relations (
8181 chatConversationFile ,
8282 ( { one } ) => ( {
@@ -258,14 +258,14 @@ export const neptunUserTemplateRelations = relations(
258258 fields : [ neptunUserTemplate . neptunUserId ] ,
259259 references : [ neptunUser . id ] ,
260260 } ) ,
261- neptunUserTemplateCollection : one ( neptunUserTemplateCollection , {
262- fields : [ neptunUserTemplate . templateCollectionId ] ,
263- references : [ neptunUserTemplateCollection . id ] ,
264- } ) ,
265261 neptunUserFile : one ( neptunUserFile , {
266262 fields : [ neptunUserTemplate . userFileId ] ,
267263 references : [ neptunUserFile . id ] ,
268264 } ) ,
265+ neptunUserTemplateCollection : one ( neptunUserTemplateCollection , {
266+ fields : [ neptunUserTemplate . templateCollectionId ] ,
267+ references : [ neptunUserTemplateCollection . id ] ,
268+ } ) ,
269269 } ) ,
270270) ;
271271
0 commit comments