@@ -8,8 +8,15 @@ import {
88 neptunUserFile ,
99 githubAppInstallation ,
1010 githubAppInstallationRepository ,
11- neptunUserTemplate ,
11+ neptunContextFile ,
12+ neptunContextImport ,
13+ neptunUserProject ,
14+ projectChatConversation ,
15+ projectGithubInstallation ,
16+ projectTemplateCollection ,
1217 neptunUserTemplateCollection ,
18+ projectUserFile ,
19+ neptunUserTemplate ,
1320 chatConversationShare ,
1421 chatConversationShareWhitelistEntry ,
1522} from "./schema.js" ;
@@ -23,6 +30,7 @@ export const chatConversationRelations = relations(
2330 } ) ,
2431 chatConversationMessages : many ( chatConversationMessage ) ,
2532 chatConversationFiles : many ( chatConversationFile ) ,
33+ projectChatConversations : many ( projectChatConversation ) ,
2634 chatConversationShares : many ( chatConversationShare ) ,
2735 } ) ,
2836) ;
@@ -33,6 +41,9 @@ export const neptunUserRelations = relations(neptunUser, ({ many }) => ({
3341 chatConversationMessages : many ( chatConversationMessage ) ,
3442 chatConversationFiles : many ( chatConversationFile ) ,
3543 githubAppInstallations : many ( githubAppInstallation ) ,
44+ neptunContextFiles : many ( neptunContextFile ) ,
45+ neptunContextImports : many ( neptunContextImport ) ,
46+ neptunUserProjects : many ( neptunUserProject ) ,
3647 neptunUserTemplates : many ( neptunUserTemplate ) ,
3748 neptunUserFiles : many ( neptunUserFile ) ,
3849 neptunUserTemplateCollections : many ( neptunUserTemplateCollection ) ,
@@ -92,6 +103,7 @@ export const neptunUserFileRelations = relations(
92103 neptunUserFile ,
93104 ( { one, many } ) => ( {
94105 chatConversationFiles : many ( chatConversationFile ) ,
106+ projectUserFiles : many ( projectUserFile ) ,
95107 neptunUserTemplates : many ( neptunUserTemplate ) ,
96108 neptunUser : one ( neptunUser , {
97109 fields : [ neptunUserFile . neptunUserId ] ,
@@ -108,6 +120,7 @@ export const githubAppInstallationRelations = relations(
108120 references : [ neptunUser . id ] ,
109121 } ) ,
110122 githubAppInstallationRepositories : many ( githubAppInstallationRepository ) ,
123+ projectGithubInstallations : many ( projectGithubInstallation ) ,
111124 } ) ,
112125) ;
113126
@@ -121,27 +134,101 @@ export const githubAppInstallationRepositoryRelations = relations(
121134 } ) ,
122135) ;
123136
124- export const neptunUserTemplateRelations = relations (
125- neptunUserTemplate ,
137+ export const neptunContextFileRelations = relations (
138+ neptunContextFile ,
126139 ( { one } ) => ( {
127140 neptunUser : one ( neptunUser , {
128- fields : [ neptunUserTemplate . neptunUserId ] ,
141+ fields : [ neptunContextFile . neptunUserId ] ,
129142 references : [ neptunUser . id ] ,
130143 } ) ,
144+ neptunContextImport : one ( neptunContextImport , {
145+ fields : [ neptunContextFile . importId ] ,
146+ references : [ neptunContextImport . id ] ,
147+ } ) ,
148+ neptunUserProject : one ( neptunUserProject , {
149+ fields : [ neptunContextFile . projectId ] ,
150+ references : [ neptunUserProject . id ] ,
151+ } ) ,
152+ } ) ,
153+ ) ;
154+
155+ export const neptunContextImportRelations = relations (
156+ neptunContextImport ,
157+ ( { one, many } ) => ( {
158+ neptunContextFiles : many ( neptunContextFile ) ,
159+ neptunUser : one ( neptunUser , {
160+ fields : [ neptunContextImport . neptunUserId ] ,
161+ references : [ neptunUser . id ] ,
162+ } ) ,
163+ neptunUserProject : one ( neptunUserProject , {
164+ fields : [ neptunContextImport . projectId ] ,
165+ references : [ neptunUserProject . id ] ,
166+ } ) ,
167+ } ) ,
168+ ) ;
169+
170+ export const neptunUserProjectRelations = relations (
171+ neptunUserProject ,
172+ ( { one, many } ) => ( {
173+ neptunContextFiles : many ( neptunContextFile ) ,
174+ neptunContextImports : many ( neptunContextImport ) ,
175+ neptunUser : one ( neptunUser , {
176+ fields : [ neptunUserProject . neptunUserId ] ,
177+ references : [ neptunUser . id ] ,
178+ } ) ,
179+ projectChatConversations : many ( projectChatConversation ) ,
180+ projectGithubInstallations : many ( projectGithubInstallation ) ,
181+ projectTemplateCollections : many ( projectTemplateCollection ) ,
182+ projectUserFiles : many ( projectUserFile ) ,
183+ } ) ,
184+ ) ;
185+
186+ export const projectChatConversationRelations = relations (
187+ projectChatConversation ,
188+ ( { one } ) => ( {
189+ neptunUserProject : one ( neptunUserProject , {
190+ fields : [ projectChatConversation . projectId ] ,
191+ references : [ neptunUserProject . id ] ,
192+ } ) ,
193+ chatConversation : one ( chatConversation , {
194+ fields : [ projectChatConversation . chatConversationId ] ,
195+ references : [ chatConversation . id ] ,
196+ } ) ,
197+ } ) ,
198+ ) ;
199+
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 ,
216+ ( { one } ) => ( {
217+ neptunUserProject : one ( neptunUserProject , {
218+ fields : [ projectTemplateCollection . projectId ] ,
219+ references : [ neptunUserProject . id ] ,
220+ } ) ,
131221 neptunUserTemplateCollection : one ( neptunUserTemplateCollection , {
132- fields : [ neptunUserTemplate . templateCollectionId ] ,
222+ fields : [ projectTemplateCollection . templateCollectionId ] ,
133223 references : [ neptunUserTemplateCollection . id ] ,
134224 } ) ,
135- neptunUserFile : one ( neptunUserFile , {
136- fields : [ neptunUserTemplate . userFileId ] ,
137- references : [ neptunUserFile . id ] ,
138- } ) ,
139225 } ) ,
140226) ;
141227
142228export const neptunUserTemplateCollectionRelations = relations (
143229 neptunUserTemplateCollection ,
144230 ( { one, many } ) => ( {
231+ projectTemplateCollections : many ( projectTemplateCollection ) ,
145232 neptunUserTemplates : many ( neptunUserTemplate ) ,
146233 neptunUser : one ( neptunUser , {
147234 fields : [ neptunUserTemplateCollection . neptunUserId ] ,
@@ -150,6 +237,38 @@ export const neptunUserTemplateCollectionRelations = relations(
150237 } ) ,
151238) ;
152239
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+
254+ export const neptunUserTemplateRelations = relations (
255+ neptunUserTemplate ,
256+ ( { one } ) => ( {
257+ neptunUser : one ( neptunUser , {
258+ fields : [ neptunUserTemplate . neptunUserId ] ,
259+ references : [ neptunUser . id ] ,
260+ } ) ,
261+ neptunUserTemplateCollection : one ( neptunUserTemplateCollection , {
262+ fields : [ neptunUserTemplate . templateCollectionId ] ,
263+ references : [ neptunUserTemplateCollection . id ] ,
264+ } ) ,
265+ neptunUserFile : one ( neptunUserFile , {
266+ fields : [ neptunUserTemplate . userFileId ] ,
267+ references : [ neptunUserFile . id ] ,
268+ } ) ,
269+ } ) ,
270+ ) ;
271+
153272export const chatConversationShareRelations = relations (
154273 chatConversationShare ,
155274 ( { one, many } ) => ( {
0 commit comments