@@ -3,22 +3,16 @@ import {
33 neptunUser ,
44 neptunUserOauthAccount ,
55 chatConversationMessage ,
6- chatConversation ,
76 chatConversationFile ,
8- neptunUserFile ,
7+ chatConversation ,
98 githubAppInstallation ,
10- githubAppInstallationRepository ,
119 neptunContextFile ,
1210 neptunContextImport ,
1311 neptunUserProject ,
1412 projectChatConversation ,
15- projectGithubInstallation ,
16- projectTemplateCollection ,
17- neptunUserTemplateCollection ,
1813 projectUserFile ,
14+ neptunUserFile ,
1915 neptunUserTemplate ,
20- chatConversationShare ,
21- chatConversationShareWhitelistEntry ,
2216} from "./schema.js" ;
2317
2418export const neptunUserOauthAccountRelations = relations (
@@ -42,38 +36,15 @@ export const neptunUserRelations = relations(neptunUser, ({ many }) => ({
4236 neptunUserProjects : many ( neptunUserProject ) ,
4337 neptunUserTemplates : many ( neptunUserTemplate ) ,
4438 neptunUserFiles : many ( neptunUserFile ) ,
45- neptunUserTemplateCollections : many ( neptunUserTemplateCollection ) ,
46- chatConversationShareWhitelistEntries : many (
47- chatConversationShareWhitelistEntry ,
48- ) ,
4939} ) ) ;
5040
5141export const chatConversationMessageRelations = relations (
5242 chatConversationMessage ,
53- ( { one, many } ) => ( {
43+ ( { one } ) => ( {
5444 neptunUser : one ( neptunUser , {
5545 fields : [ chatConversationMessage . neptunUserId ] ,
5646 references : [ neptunUser . id ] ,
5747 } ) ,
58- chatConversation : one ( chatConversation , {
59- fields : [ chatConversationMessage . chatConversationId ] ,
60- references : [ chatConversation . id ] ,
61- } ) ,
62- chatConversationFiles : many ( chatConversationFile ) ,
63- } ) ,
64- ) ;
65-
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 ) ,
7748 } ) ,
7849) ;
7950
@@ -84,53 +55,26 @@ export const chatConversationFileRelations = relations(
8455 fields : [ chatConversationFile . neptunUserId ] ,
8556 references : [ neptunUser . id ] ,
8657 } ) ,
87- chatConversation : one ( chatConversation , {
88- fields : [ chatConversationFile . chatConversationId ] ,
89- references : [ chatConversation . id ] ,
90- } ) ,
91- chatConversationMessage : one ( chatConversationMessage , {
92- fields : [ chatConversationFile . chatConversationMessageId ] ,
93- references : [ chatConversationMessage . id ] ,
94- } ) ,
95- neptunUserFile : one ( neptunUserFile , {
96- fields : [ chatConversationFile . neptunUserFileId ] ,
97- references : [ neptunUserFile . id ] ,
98- } ) ,
9958 } ) ,
10059) ;
10160
102- export const neptunUserFileRelations = relations (
103- neptunUserFile ,
104- ( { one, many } ) => ( {
105- chatConversationFiles : many ( chatConversationFile ) ,
106- projectUserFiles : many ( projectUserFile ) ,
107- neptunUserTemplates : many ( neptunUserTemplate ) ,
61+ export const chatConversationRelations = relations (
62+ chatConversation ,
63+ ( { one } ) => ( {
10864 neptunUser : one ( neptunUser , {
109- fields : [ neptunUserFile . neptunUserId ] ,
65+ fields : [ chatConversation . neptunUserId ] ,
11066 references : [ neptunUser . id ] ,
11167 } ) ,
11268 } ) ,
11369) ;
11470
11571export const githubAppInstallationRelations = relations (
11672 githubAppInstallation ,
117- ( { one, many } ) => ( {
73+ ( { one } ) => ( {
11874 neptunUser : one ( neptunUser , {
11975 fields : [ githubAppInstallation . neptunUserId ] ,
12076 references : [ neptunUser . id ] ,
12177 } ) ,
122- githubAppInstallationRepositories : many ( githubAppInstallationRepository ) ,
123- projectGithubInstallations : many ( projectGithubInstallation ) ,
124- } ) ,
125- ) ;
126-
127- export const githubAppInstallationRepositoryRelations = relations (
128- githubAppInstallationRepository ,
129- ( { one } ) => ( {
130- githubAppInstallation : one ( githubAppInstallation , {
131- fields : [ githubAppInstallationRepository . githubAppInstallationId ] ,
132- references : [ githubAppInstallation . id ] ,
133- } ) ,
13478 } ) ,
13579) ;
13680
@@ -177,8 +121,6 @@ export const neptunUserProjectRelations = relations(
177121 references : [ neptunUser . id ] ,
178122 } ) ,
179123 projectChatConversations : many ( projectChatConversation ) ,
180- projectGithubInstallations : many ( projectGithubInstallation ) ,
181- projectTemplateCollections : many ( projectTemplateCollection ) ,
182124 projectUserFiles : many ( projectUserFile ) ,
183125 } ) ,
184126) ;
@@ -190,67 +132,35 @@ export const projectChatConversationRelations = relations(
190132 fields : [ projectChatConversation . projectId ] ,
191133 references : [ neptunUserProject . id ] ,
192134 } ) ,
193- chatConversation : one ( chatConversation , {
194- fields : [ projectChatConversation . chatConversationId ] ,
195- references : [ chatConversation . id ] ,
196- } ) ,
197135 } ) ,
198136) ;
199137
200- export const projectGithubInstallationRelations = relations (
201- projectGithubInstallation ,
202- ( { one } ) => ( {
203- neptunUserProject : one ( neptunUserProject , {
204- fields : [ projectGithubInstallation . projectId ] ,
205- references : [ neptunUserProject . id ] ,
206- } ) ,
207- githubAppInstallation : one ( githubAppInstallation , {
208- fields : [ projectGithubInstallation . githubInstallationId ] ,
209- references : [ githubAppInstallation . id ] ,
210- } ) ,
211- } ) ,
212- ) ;
213-
214- export const projectTemplateCollectionRelations = relations (
215- projectTemplateCollection ,
138+ export const projectUserFileRelations = relations (
139+ projectUserFile ,
216140 ( { one } ) => ( {
217141 neptunUserProject : one ( neptunUserProject , {
218- fields : [ projectTemplateCollection . projectId ] ,
142+ fields : [ projectUserFile . projectId ] ,
219143 references : [ neptunUserProject . id ] ,
220144 } ) ,
221- neptunUserTemplateCollection : one ( neptunUserTemplateCollection , {
222- fields : [ projectTemplateCollection . templateCollectionId ] ,
223- references : [ neptunUserTemplateCollection . id ] ,
145+ neptunUserFile : one ( neptunUserFile , {
146+ fields : [ projectUserFile . userFileId ] ,
147+ references : [ neptunUserFile . id ] ,
224148 } ) ,
225149 } ) ,
226150) ;
227151
228- export const neptunUserTemplateCollectionRelations = relations (
229- neptunUserTemplateCollection ,
152+ export const neptunUserFileRelations = relations (
153+ neptunUserFile ,
230154 ( { one, many } ) => ( {
231- projectTemplateCollections : many ( projectTemplateCollection ) ,
155+ projectUserFiles : many ( projectUserFile ) ,
232156 neptunUserTemplates : many ( neptunUserTemplate ) ,
233157 neptunUser : one ( neptunUser , {
234- fields : [ neptunUserTemplateCollection . neptunUserId ] ,
158+ fields : [ neptunUserFile . neptunUserId ] ,
235159 references : [ neptunUser . id ] ,
236160 } ) ,
237161 } ) ,
238162) ;
239163
240- export const projectUserFileRelations = relations (
241- projectUserFile ,
242- ( { one } ) => ( {
243- neptunUserProject : one ( neptunUserProject , {
244- fields : [ projectUserFile . projectId ] ,
245- references : [ neptunUserProject . id ] ,
246- } ) ,
247- neptunUserFile : one ( neptunUserFile , {
248- fields : [ projectUserFile . userFileId ] ,
249- references : [ neptunUserFile . id ] ,
250- } ) ,
251- } ) ,
252- ) ;
253-
254164export const neptunUserTemplateRelations = relations (
255165 neptunUserTemplate ,
256166 ( { one } ) => ( {
@@ -262,36 +172,5 @@ export const neptunUserTemplateRelations = relations(
262172 fields : [ neptunUserTemplate . userFileId ] ,
263173 references : [ neptunUserFile . id ] ,
264174 } ) ,
265- neptunUserTemplateCollection : one ( neptunUserTemplateCollection , {
266- fields : [ neptunUserTemplate . templateCollectionId ] ,
267- references : [ neptunUserTemplateCollection . id ] ,
268- } ) ,
269- } ) ,
270- ) ;
271-
272- export const chatConversationShareRelations = relations (
273- chatConversationShare ,
274- ( { one, many } ) => ( {
275- chatConversation : one ( chatConversation , {
276- fields : [ chatConversationShare . chatConversationId ] ,
277- references : [ chatConversation . id ] ,
278- } ) ,
279- chatConversationShareWhitelistEntries : many (
280- chatConversationShareWhitelistEntry ,
281- ) ,
282- } ) ,
283- ) ;
284-
285- export const chatConversationShareWhitelistEntryRelations = relations (
286- chatConversationShareWhitelistEntry ,
287- ( { one } ) => ( {
288- neptunUser : one ( neptunUser , {
289- fields : [ chatConversationShareWhitelistEntry . whitelistedNeptunUserId ] ,
290- references : [ neptunUser . id ] ,
291- } ) ,
292- chatConversationShare : one ( chatConversationShare , {
293- fields : [ chatConversationShareWhitelistEntry . chatConversationShareId ] ,
294- references : [ chatConversationShare . id ] ,
295- } ) ,
296175 } ) ,
297176) ;
0 commit comments