Xyro123 commited on
Commit
5a277f0
·
verified ·
1 Parent(s): 685d4ae

Delete backend.json

Browse files
Files changed (1) hide show
  1. backend.json +0 -193
backend.json DELETED
@@ -1,193 +0,0 @@
1
- {
2
- "entities": {
3
- "User": {
4
- "$schema": "http://json-schema.org/draft-07/schema#",
5
- "title": "User",
6
- "type": "object",
7
- "description": "Represents a user of the ZeppFusion AI application.",
8
- "properties": {
9
- "id": {
10
- "type": "string",
11
- "description": "Unique identifier for the User entity."
12
- },
13
- "email": {
14
- "type": "string",
15
- "description": "Email address of the user.",
16
- "format": "email"
17
- },
18
- "displayName": {
19
- "type": "string",
20
- "description": "Display name of the user."
21
- },
22
- "creationDate": {
23
- "type": "string",
24
- "description": "Date and time the user account was created.",
25
- "format": "date-time"
26
- },
27
- "lastLogin": {
28
- "type": "string",
29
- "description": "Date and time of the user's last login.",
30
- "format": "date-time"
31
- },
32
- "theme": {
33
- "type": "string",
34
- "description": "The user's preferred theme.",
35
- "enum": [
36
- "light",
37
- "dark",
38
- "system"
39
- ]
40
- }
41
- },
42
- "required": [
43
- "id",
44
- "email",
45
- "displayName",
46
- "creationDate"
47
- ]
48
- },
49
- "ChatSession": {
50
- "$schema": "http://json-schema.org/draft-07/schema#",
51
- "title": "ChatSession",
52
- "type": "object",
53
- "description": "Represents a chat session between a user and one or more AI models.",
54
- "properties": {
55
- "id": {
56
- "type": "string",
57
- "description": "Unique identifier for the ChatSession entity."
58
- },
59
- "userId": {
60
- "type": "string",
61
- "description": "Reference to User. (Relationship: User 1:N ChatSession)"
62
- },
63
- "modelUsed": {
64
- "type": "string",
65
- "description": "The AI model used in this chat session (e.g., Gemini, ChatGPT 3)."
66
- },
67
- "startTime": {
68
- "type": "string",
69
- "description": "Date and time the chat session started.",
70
- "format": "date-time"
71
- },
72
- "endTime": {
73
- "type": "string",
74
- "description": "Date and time the chat session ended.",
75
- "format": "date-time"
76
- }
77
- },
78
- "required": [
79
- "id",
80
- "userId",
81
- "modelUsed",
82
- "startTime"
83
- ]
84
- },
85
- "Message": {
86
- "$schema": "http://json-schema.org/draft-07/schema#",
87
- "title": "Message",
88
- "type": "object",
89
- "description": "Represents a single message within a chat session.",
90
- "properties": {
91
- "id": {
92
- "type": "string",
93
- "description": "Unique identifier for the Message entity."
94
- },
95
- "chatSessionId": {
96
- "type": "string",
97
- "description": "Reference to ChatSession. (Relationship: ChatSession 1:N Message)"
98
- },
99
- "sender": {
100
- "type": "string",
101
- "description": "Indicates who sent the message (e.g., user, Gemini, ChatGPT)."
102
- },
103
- "content": {
104
- "type": "string",
105
- "description": "The text content of the message."
106
- },
107
- "timestamp": {
108
- "type": "string",
109
- "description": "Date and time the message was sent.",
110
- "format": "date-time"
111
- }
112
- },
113
- "required": [
114
- "id",
115
- "chatSessionId",
116
- "sender",
117
- "content",
118
- "timestamp"
119
- ]
120
- }
121
- },
122
- "auth": {
123
- "providers": [
124
- "password",
125
- "anonymous"
126
- ]
127
- },
128
- "firestore": {
129
- "structure": [
130
- {
131
- "path": "/users/{userId}",
132
- "definition": {
133
- "entityName": "User",
134
- "schema": {
135
- "$ref": "#/backend/entities/User"
136
- },
137
- "description": "Stores user profile data. Path-based ownership enables simple security rules.",
138
- "params": [
139
- {
140
- "name": "userId",
141
- "description": "The unique identifier of the user."
142
- }
143
- ]
144
- }
145
- },
146
- {
147
- "path": "/users/{userId}/chatSessions/{chatSessionId}",
148
- "definition": {
149
- "entityName": "ChatSession",
150
- "schema": {
151
- "$ref": "#/backend/entities/ChatSession"
152
- },
153
- "description": "Stores chat session data for a specific user. Nested under users for ownership.",
154
- "params": [
155
- {
156
- "name": "userId",
157
- "description": "The unique identifier of the user."
158
- },
159
- {
160
- "name": "chatSessionId",
161
- "description": "The unique identifier of the chat session."
162
- }
163
- ]
164
- }
165
- },
166
- {
167
- "path": "/users/{userId}/chatSessions/{chatSessionId}/messages/{messageId}",
168
- "definition": {
169
- "entityName": "Message",
170
- "schema": {
171
- "$ref": "#/backend/entities/Message"
172
- },
173
- "description": "Stores messages within a chat session. Nested under chat sessions for data locality and ownership.",
174
- "params": [
175
- {
176
- "name": "userId",
177
- "description": "The unique identifier of the user."
178
- },
179
- {
180
- "name": "chatSessionId",
181
- "description": "The unique identifier of the chat session."
182
- },
183
- {
184
- "name": "messageId",
185
- "description": "The unique identifier of the message."
186
- }
187
- ]
188
- }
189
- }
190
- ],
191
- "reasoning": "The Firestore structure is designed to ensure authorization independence, clarity, and scalability. User data is stored under `/users/{userId}`, providing path-based ownership, and chat sessions and messages are nested under the user for clear ownership and easy querying. Denormalization is avoided since the application use case fits a strict ownership model. This structure allows for simple and robust security rules based on `request.auth.uid` without requiring complex `get()` calls, thus ensuring atomic operations and ease of debugging. The structure also facilitates secure list operations, as each collection has a consistent security posture due to the path-based ownership and nested structure."
192
- }
193
- }