обновОЧКИ
This commit is contained in:
@@ -16,15 +16,7 @@ export function qChatMessages() {
|
||||
const response = await api.chad.chatMessages({ cursor: pageParam, limit: 25 })
|
||||
|
||||
return response.data
|
||||
// return {
|
||||
// messages: response.data.messages.reverse(),
|
||||
// nextCursor: response.data.nextCursor,
|
||||
// }
|
||||
},
|
||||
// select: data => ({
|
||||
// pages: [...data.pages].reverse(),
|
||||
// pageParams: [...data.pageParams].reverse(),
|
||||
// }),
|
||||
select: (data) => {
|
||||
return data.pages.flatMap(page => page.messages).toReversed()
|
||||
},
|
||||
|
||||
62
new-client/src/widgets/chat/ui/ChatAttachment.vue
Normal file
62
new-client/src/widgets/chat/ui/ChatAttachment.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<div
|
||||
:class="[
|
||||
bem.b(),
|
||||
bem.is('loading', loading),
|
||||
bem.is('error', error),
|
||||
]"
|
||||
>
|
||||
{{ name }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import useBem from '@shared/composables/use-bem.ts'
|
||||
|
||||
const props = defineProps<{
|
||||
name: string
|
||||
loading?: boolean
|
||||
error?: boolean
|
||||
}>()
|
||||
|
||||
const bem = useBem('chat-attachment')
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.chat-attachment {
|
||||
--stripe-width: 20px;
|
||||
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
padding: var(--space-1) var(--space-2);
|
||||
background-color: var(--grey-1);
|
||||
outline: 1px solid var(--ink);
|
||||
outline-offset: -1px;
|
||||
cursor: pointer;
|
||||
|
||||
background-repeat: repeat;
|
||||
color: var(--grey-3);
|
||||
|
||||
&.is-loading {
|
||||
background-image: repeating-linear-gradient(
|
||||
-45deg,
|
||||
transparent 25%,
|
||||
transparent 50%,
|
||||
var(--grey-2) 50%,
|
||||
var(--grey-2) 75%
|
||||
);
|
||||
background-size: var(--stripe-width) var(--stripe-width);
|
||||
animation: loading 500ms infinite linear;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes loading {
|
||||
from {
|
||||
background-position-x: 0;
|
||||
}
|
||||
to {
|
||||
background-position-x: var(--stripe-width);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -17,39 +17,50 @@
|
||||
|
||||
<ChadButton
|
||||
class="chat-input__send"
|
||||
:loading="isUploading"
|
||||
@click="sendMessage()"
|
||||
>
|
||||
Send
|
||||
</ChadButton>
|
||||
</div>
|
||||
|
||||
<ul v-if="fileUploadApi.acceptedFiles.length > 0" class="chat-input__attachments" v-bind="fileUploadApi.getItemGroupProps()">
|
||||
<li
|
||||
<div v-if="fileUploadApi.acceptedFiles.length > 0" class="chat-input__attachments" v-bind="fileUploadApi.getItemGroupProps()">
|
||||
<ChatAttachment
|
||||
v-for="file in fileUploadApi.acceptedFiles"
|
||||
:key="file.name"
|
||||
:loading="uploadStates.get(file)?.status === 'loading'"
|
||||
:error="uploadStates.get(file)?.status === 'error'"
|
||||
class="chat-input__attachment"
|
||||
v-bind="fileUploadApi.getItemProps({ file })"
|
||||
@click="fileUploadApi.deleteFile(file)"
|
||||
>
|
||||
{{ file.name }}
|
||||
</li>
|
||||
</ul>
|
||||
:name="file.name"
|
||||
@click="removeFile(file)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<input v-bind="fileUploadApi.getHiddenInputProps()">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { NewChatMessagePayload } from '@shared/api/generated-chad-api.ts'
|
||||
import type { FullRequestParams, NewChatMessagePayload } from '@shared/api/generated-chad-api.ts'
|
||||
import { Plus } from '@lucide/vue'
|
||||
import api from '@shared/api/client.ts'
|
||||
import { ContentType } from '@shared/api/generated-chad-api.ts'
|
||||
import ChadButton from '@shared/components/ui/Button.vue'
|
||||
import ChadInput from '@shared/components/ui/Input.vue'
|
||||
import { useEventListener } from '@vueuse/core'
|
||||
import { useChat } from '@widgets/chat/composables/use-chat.ts'
|
||||
import ChatAttachment from '@widgets/chat/ui/ChatAttachment.vue'
|
||||
import * as fileUpload from '@zag-js/file-upload'
|
||||
import { normalizeProps, useMachine } from '@zag-js/vue'
|
||||
import { computed, reactive, useId } from 'vue'
|
||||
|
||||
interface UploadStatus {
|
||||
status: 'loading' | 'done' | 'error'
|
||||
uuid?: string
|
||||
abortController: AbortController
|
||||
}
|
||||
|
||||
const id = useId()
|
||||
const chat = useChat()
|
||||
|
||||
@@ -58,22 +69,46 @@ const message: NewChatMessagePayload = reactive({
|
||||
attachments: [],
|
||||
})
|
||||
|
||||
const uploadStates = reactive(new Map<File, UploadStatus>())
|
||||
|
||||
const isUploading = computed(() => {
|
||||
return Array.from(uploadStates.values()).some(s => s.status === 'loading')
|
||||
})
|
||||
|
||||
const service = useMachine(fileUpload.machine, {
|
||||
id,
|
||||
maxFiles: 10,
|
||||
maxFileSize: 100 * 1024 * 1024,
|
||||
maxFileSize: 1000 * 1024 * 1024,
|
||||
name: 'chat-input',
|
||||
capture: 'environment',
|
||||
allowDrop: false,
|
||||
onFileAccept: (details) => {
|
||||
console.log('onFileAccept', details)
|
||||
},
|
||||
// transformFiles: async (files) => {
|
||||
// console.log(files)
|
||||
//
|
||||
// return files
|
||||
// },
|
||||
for (const file of details.files) {
|
||||
if (uploadStates.has(file))
|
||||
continue
|
||||
|
||||
const state: UploadStatus = { status: 'loading', abortController: new AbortController() }
|
||||
uploadStates.set(file, state)
|
||||
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
|
||||
try {
|
||||
api.chad.attachmentUpload({
|
||||
body: formData,
|
||||
format: 'text',
|
||||
type: ContentType.FormData,
|
||||
signal: state.abortController.signal,
|
||||
} as FullRequestParams).then((response) => {
|
||||
uploadStates.set(file, { ...state, status: 'done', uuid: response.data })
|
||||
message.attachments!.push(response.data)
|
||||
})
|
||||
}
|
||||
catch {
|
||||
uploadStates.set(file, { ...state, status: 'error' })
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
const fileUploadApi = computed(() => fileUpload.connect(service, normalizeProps))
|
||||
@@ -82,7 +117,16 @@ useEventListener(document, 'paste', (event) => {
|
||||
fileUploadApi.value.setClipboardFiles(event.clipboardData)
|
||||
})
|
||||
|
||||
function removeFile(file: File) {
|
||||
uploadStates.get(file)?.abortController.abort('Attachment removed')
|
||||
uploadStates.delete(file)
|
||||
fileUploadApi.value.deleteFile(file)
|
||||
}
|
||||
|
||||
function sendMessage() {
|
||||
if (isUploading.value)
|
||||
return
|
||||
|
||||
chat.sendMessage(message)
|
||||
|
||||
reset()
|
||||
@@ -91,6 +135,8 @@ function sendMessage() {
|
||||
function reset() {
|
||||
message.text = ''
|
||||
message.attachments = []
|
||||
uploadStates.clear()
|
||||
fileUploadApi.value.clearFiles()
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -125,14 +171,11 @@ function reset() {
|
||||
margin-top: var(--space-2);
|
||||
outline: var(--border-w) dashed var(--ink);
|
||||
outline-offset: calc(var(--border-w) * -1);
|
||||
}
|
||||
overflow: hidden;
|
||||
|
||||
&__attachment {
|
||||
padding: var(--space-1) var(--space-2);
|
||||
background-color: var(--grey-1);
|
||||
outline: 1px solid var(--ink);
|
||||
outline-offset: -1px;
|
||||
cursor: pointer;
|
||||
> * {
|
||||
max-width: 300px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="chat-message-attachment" @click="download">
|
||||
<div class="chat-message-attachment" :title="attachment.name" @click="download">
|
||||
<div class="chat-message-attachment__extension">
|
||||
{{ extension }}
|
||||
</div>
|
||||
@@ -8,7 +8,7 @@
|
||||
{{ attachment.name }}
|
||||
</p>
|
||||
<p class="chat-message-attachment__size">
|
||||
{{ attachment.size }} KB
|
||||
{{ size }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -18,18 +18,23 @@
|
||||
import type { Attachment } from '@shared/api/generated-chad-api.ts'
|
||||
import api from '@shared/api/client.ts'
|
||||
import { downloadFile } from '@zag-js/file-utils'
|
||||
import { formatBytes } from '@zag-js/i18n-utils'
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = defineProps<{
|
||||
attachment: Attachment
|
||||
}>()
|
||||
|
||||
const extension = computed(() => props.attachment.name.split('.')[1])
|
||||
const extension = computed(() => props.attachment.name.split('.').at(-1))
|
||||
|
||||
const url = computed(() => {
|
||||
return `${__API_BASE_URL__}/attachment/${props.attachment.id}`
|
||||
})
|
||||
|
||||
const size = computed(() => {
|
||||
return formatBytes(props.attachment.size, 'en-US', { unitSystem: 'binary' })
|
||||
})
|
||||
|
||||
async function download() {
|
||||
const response = await api.chad.attachmentGet(props.attachment.id, { format: 'blob' })
|
||||
|
||||
@@ -46,7 +51,7 @@ async function download() {
|
||||
background-color: var(--grey-1);
|
||||
width: 300px;
|
||||
height: 52px;
|
||||
//overflow: hidden;
|
||||
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
@@ -68,6 +73,7 @@ async function download() {
|
||||
flex: 1;
|
||||
padding: var(--space-3);
|
||||
align-self: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&__name {
|
||||
|
||||
@@ -26,6 +26,8 @@ const src = computed(() => {
|
||||
height: 160px;
|
||||
|
||||
> img {
|
||||
object-fit: contain;
|
||||
object-position: center;
|
||||
max-width: 260px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export const ChatMessageSchema = Type.Object({
|
||||
}, { $id: 'ChatMessage' })
|
||||
|
||||
export const NewChatMessagePayloadSchema = Type.Object({
|
||||
text: Type.String({ minLength: 1 }),
|
||||
text: Type.String(),
|
||||
attachments: Type.Optional(Type.Array(Type.String({ format: 'uuid' }))),
|
||||
// replyTo: Type.Object({
|
||||
// messageId: Type.String({ format: 'uuid' }),
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -995,6 +995,7 @@ export type UserPreferencesScalarFieldEnum = (typeof UserPreferencesScalarFieldE
|
||||
|
||||
export const AttachmentScalarFieldEnum = {
|
||||
id: 'id',
|
||||
username: 'username',
|
||||
name: 'name',
|
||||
mimetype: 'mimetype',
|
||||
size: 'size',
|
||||
|
||||
@@ -104,6 +104,7 @@ export type UserPreferencesScalarFieldEnum = (typeof UserPreferencesScalarFieldE
|
||||
|
||||
export const AttachmentScalarFieldEnum = {
|
||||
id: 'id',
|
||||
username: 'username',
|
||||
name: 'name',
|
||||
mimetype: 'mimetype',
|
||||
size: 'size',
|
||||
|
||||
@@ -36,6 +36,7 @@ export type AttachmentSumAggregateOutputType = {
|
||||
|
||||
export type AttachmentMinAggregateOutputType = {
|
||||
id: string | null
|
||||
username: string | null
|
||||
name: string | null
|
||||
mimetype: string | null
|
||||
size: number | null
|
||||
@@ -44,6 +45,7 @@ export type AttachmentMinAggregateOutputType = {
|
||||
|
||||
export type AttachmentMaxAggregateOutputType = {
|
||||
id: string | null
|
||||
username: string | null
|
||||
name: string | null
|
||||
mimetype: string | null
|
||||
size: number | null
|
||||
@@ -52,6 +54,7 @@ export type AttachmentMaxAggregateOutputType = {
|
||||
|
||||
export type AttachmentCountAggregateOutputType = {
|
||||
id: number
|
||||
username: number
|
||||
name: number
|
||||
mimetype: number
|
||||
size: number
|
||||
@@ -70,6 +73,7 @@ export type AttachmentSumAggregateInputType = {
|
||||
|
||||
export type AttachmentMinAggregateInputType = {
|
||||
id?: true
|
||||
username?: true
|
||||
name?: true
|
||||
mimetype?: true
|
||||
size?: true
|
||||
@@ -78,6 +82,7 @@ export type AttachmentMinAggregateInputType = {
|
||||
|
||||
export type AttachmentMaxAggregateInputType = {
|
||||
id?: true
|
||||
username?: true
|
||||
name?: true
|
||||
mimetype?: true
|
||||
size?: true
|
||||
@@ -86,6 +91,7 @@ export type AttachmentMaxAggregateInputType = {
|
||||
|
||||
export type AttachmentCountAggregateInputType = {
|
||||
id?: true
|
||||
username?: true
|
||||
name?: true
|
||||
mimetype?: true
|
||||
size?: true
|
||||
@@ -181,6 +187,7 @@ export type AttachmentGroupByArgs<ExtArgs extends runtime.Types.Extensions.Inter
|
||||
|
||||
export type AttachmentGroupByOutputType = {
|
||||
id: string
|
||||
username: string | null
|
||||
name: string
|
||||
mimetype: string
|
||||
size: number
|
||||
@@ -212,19 +219,23 @@ export type AttachmentWhereInput = {
|
||||
OR?: Prisma.AttachmentWhereInput[]
|
||||
NOT?: Prisma.AttachmentWhereInput | Prisma.AttachmentWhereInput[]
|
||||
id?: Prisma.StringFilter<"Attachment"> | string
|
||||
username?: Prisma.StringNullableFilter<"Attachment"> | string | null
|
||||
name?: Prisma.StringFilter<"Attachment"> | string
|
||||
mimetype?: Prisma.StringFilter<"Attachment"> | string
|
||||
size?: Prisma.IntFilter<"Attachment"> | number
|
||||
createdAt?: Prisma.DateTimeFilter<"Attachment"> | Date | string
|
||||
user?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
|
||||
message?: Prisma.MessageAttachmentListRelationFilter
|
||||
}
|
||||
|
||||
export type AttachmentOrderByWithRelationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
username?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
mimetype?: Prisma.SortOrder
|
||||
size?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
user?: Prisma.UserOrderByWithRelationInput
|
||||
message?: Prisma.MessageAttachmentOrderByRelationAggregateInput
|
||||
}
|
||||
|
||||
@@ -233,15 +244,18 @@ export type AttachmentWhereUniqueInput = Prisma.AtLeast<{
|
||||
AND?: Prisma.AttachmentWhereInput | Prisma.AttachmentWhereInput[]
|
||||
OR?: Prisma.AttachmentWhereInput[]
|
||||
NOT?: Prisma.AttachmentWhereInput | Prisma.AttachmentWhereInput[]
|
||||
username?: Prisma.StringNullableFilter<"Attachment"> | string | null
|
||||
name?: Prisma.StringFilter<"Attachment"> | string
|
||||
mimetype?: Prisma.StringFilter<"Attachment"> | string
|
||||
size?: Prisma.IntFilter<"Attachment"> | number
|
||||
createdAt?: Prisma.DateTimeFilter<"Attachment"> | Date | string
|
||||
user?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
|
||||
message?: Prisma.MessageAttachmentListRelationFilter
|
||||
}, "id">
|
||||
|
||||
export type AttachmentOrderByWithAggregationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
username?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
mimetype?: Prisma.SortOrder
|
||||
size?: Prisma.SortOrder
|
||||
@@ -258,6 +272,7 @@ export type AttachmentScalarWhereWithAggregatesInput = {
|
||||
OR?: Prisma.AttachmentScalarWhereWithAggregatesInput[]
|
||||
NOT?: Prisma.AttachmentScalarWhereWithAggregatesInput | Prisma.AttachmentScalarWhereWithAggregatesInput[]
|
||||
id?: Prisma.StringWithAggregatesFilter<"Attachment"> | string
|
||||
username?: Prisma.StringNullableWithAggregatesFilter<"Attachment"> | string | null
|
||||
name?: Prisma.StringWithAggregatesFilter<"Attachment"> | string
|
||||
mimetype?: Prisma.StringWithAggregatesFilter<"Attachment"> | string
|
||||
size?: Prisma.IntWithAggregatesFilter<"Attachment"> | number
|
||||
@@ -270,11 +285,13 @@ export type AttachmentCreateInput = {
|
||||
mimetype: string
|
||||
size: number
|
||||
createdAt?: Date | string
|
||||
user?: Prisma.UserCreateNestedOneWithoutAttachmentsInput
|
||||
message?: Prisma.MessageAttachmentCreateNestedManyWithoutAttachmentInput
|
||||
}
|
||||
|
||||
export type AttachmentUncheckedCreateInput = {
|
||||
id?: string
|
||||
username?: string | null
|
||||
name: string
|
||||
mimetype: string
|
||||
size: number
|
||||
@@ -288,11 +305,13 @@ export type AttachmentUpdateInput = {
|
||||
mimetype?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
size?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
user?: Prisma.UserUpdateOneWithoutAttachmentsNestedInput
|
||||
message?: Prisma.MessageAttachmentUpdateManyWithoutAttachmentNestedInput
|
||||
}
|
||||
|
||||
export type AttachmentUncheckedUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
username?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
mimetype?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
size?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
@@ -302,6 +321,7 @@ export type AttachmentUncheckedUpdateInput = {
|
||||
|
||||
export type AttachmentCreateManyInput = {
|
||||
id?: string
|
||||
username?: string | null
|
||||
name: string
|
||||
mimetype: string
|
||||
size: number
|
||||
@@ -318,14 +338,26 @@ export type AttachmentUpdateManyMutationInput = {
|
||||
|
||||
export type AttachmentUncheckedUpdateManyInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
username?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
mimetype?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
size?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type AttachmentListRelationFilter = {
|
||||
every?: Prisma.AttachmentWhereInput
|
||||
some?: Prisma.AttachmentWhereInput
|
||||
none?: Prisma.AttachmentWhereInput
|
||||
}
|
||||
|
||||
export type AttachmentOrderByRelationAggregateInput = {
|
||||
_count?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type AttachmentCountOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
username?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
mimetype?: Prisma.SortOrder
|
||||
size?: Prisma.SortOrder
|
||||
@@ -338,6 +370,7 @@ export type AttachmentAvgOrderByAggregateInput = {
|
||||
|
||||
export type AttachmentMaxOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
username?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
mimetype?: Prisma.SortOrder
|
||||
size?: Prisma.SortOrder
|
||||
@@ -346,6 +379,7 @@ export type AttachmentMaxOrderByAggregateInput = {
|
||||
|
||||
export type AttachmentMinOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
username?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
mimetype?: Prisma.SortOrder
|
||||
size?: Prisma.SortOrder
|
||||
@@ -361,6 +395,48 @@ export type AttachmentScalarRelationFilter = {
|
||||
isNot?: Prisma.AttachmentWhereInput
|
||||
}
|
||||
|
||||
export type AttachmentCreateNestedManyWithoutUserInput = {
|
||||
create?: Prisma.XOR<Prisma.AttachmentCreateWithoutUserInput, Prisma.AttachmentUncheckedCreateWithoutUserInput> | Prisma.AttachmentCreateWithoutUserInput[] | Prisma.AttachmentUncheckedCreateWithoutUserInput[]
|
||||
connectOrCreate?: Prisma.AttachmentCreateOrConnectWithoutUserInput | Prisma.AttachmentCreateOrConnectWithoutUserInput[]
|
||||
createMany?: Prisma.AttachmentCreateManyUserInputEnvelope
|
||||
connect?: Prisma.AttachmentWhereUniqueInput | Prisma.AttachmentWhereUniqueInput[]
|
||||
}
|
||||
|
||||
export type AttachmentUncheckedCreateNestedManyWithoutUserInput = {
|
||||
create?: Prisma.XOR<Prisma.AttachmentCreateWithoutUserInput, Prisma.AttachmentUncheckedCreateWithoutUserInput> | Prisma.AttachmentCreateWithoutUserInput[] | Prisma.AttachmentUncheckedCreateWithoutUserInput[]
|
||||
connectOrCreate?: Prisma.AttachmentCreateOrConnectWithoutUserInput | Prisma.AttachmentCreateOrConnectWithoutUserInput[]
|
||||
createMany?: Prisma.AttachmentCreateManyUserInputEnvelope
|
||||
connect?: Prisma.AttachmentWhereUniqueInput | Prisma.AttachmentWhereUniqueInput[]
|
||||
}
|
||||
|
||||
export type AttachmentUpdateManyWithoutUserNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.AttachmentCreateWithoutUserInput, Prisma.AttachmentUncheckedCreateWithoutUserInput> | Prisma.AttachmentCreateWithoutUserInput[] | Prisma.AttachmentUncheckedCreateWithoutUserInput[]
|
||||
connectOrCreate?: Prisma.AttachmentCreateOrConnectWithoutUserInput | Prisma.AttachmentCreateOrConnectWithoutUserInput[]
|
||||
upsert?: Prisma.AttachmentUpsertWithWhereUniqueWithoutUserInput | Prisma.AttachmentUpsertWithWhereUniqueWithoutUserInput[]
|
||||
createMany?: Prisma.AttachmentCreateManyUserInputEnvelope
|
||||
set?: Prisma.AttachmentWhereUniqueInput | Prisma.AttachmentWhereUniqueInput[]
|
||||
disconnect?: Prisma.AttachmentWhereUniqueInput | Prisma.AttachmentWhereUniqueInput[]
|
||||
delete?: Prisma.AttachmentWhereUniqueInput | Prisma.AttachmentWhereUniqueInput[]
|
||||
connect?: Prisma.AttachmentWhereUniqueInput | Prisma.AttachmentWhereUniqueInput[]
|
||||
update?: Prisma.AttachmentUpdateWithWhereUniqueWithoutUserInput | Prisma.AttachmentUpdateWithWhereUniqueWithoutUserInput[]
|
||||
updateMany?: Prisma.AttachmentUpdateManyWithWhereWithoutUserInput | Prisma.AttachmentUpdateManyWithWhereWithoutUserInput[]
|
||||
deleteMany?: Prisma.AttachmentScalarWhereInput | Prisma.AttachmentScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type AttachmentUncheckedUpdateManyWithoutUserNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.AttachmentCreateWithoutUserInput, Prisma.AttachmentUncheckedCreateWithoutUserInput> | Prisma.AttachmentCreateWithoutUserInput[] | Prisma.AttachmentUncheckedCreateWithoutUserInput[]
|
||||
connectOrCreate?: Prisma.AttachmentCreateOrConnectWithoutUserInput | Prisma.AttachmentCreateOrConnectWithoutUserInput[]
|
||||
upsert?: Prisma.AttachmentUpsertWithWhereUniqueWithoutUserInput | Prisma.AttachmentUpsertWithWhereUniqueWithoutUserInput[]
|
||||
createMany?: Prisma.AttachmentCreateManyUserInputEnvelope
|
||||
set?: Prisma.AttachmentWhereUniqueInput | Prisma.AttachmentWhereUniqueInput[]
|
||||
disconnect?: Prisma.AttachmentWhereUniqueInput | Prisma.AttachmentWhereUniqueInput[]
|
||||
delete?: Prisma.AttachmentWhereUniqueInput | Prisma.AttachmentWhereUniqueInput[]
|
||||
connect?: Prisma.AttachmentWhereUniqueInput | Prisma.AttachmentWhereUniqueInput[]
|
||||
update?: Prisma.AttachmentUpdateWithWhereUniqueWithoutUserInput | Prisma.AttachmentUpdateWithWhereUniqueWithoutUserInput[]
|
||||
updateMany?: Prisma.AttachmentUpdateManyWithWhereWithoutUserInput | Prisma.AttachmentUpdateManyWithWhereWithoutUserInput[]
|
||||
deleteMany?: Prisma.AttachmentScalarWhereInput | Prisma.AttachmentScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type IntFieldUpdateOperationsInput = {
|
||||
set?: number
|
||||
increment?: number
|
||||
@@ -383,16 +459,73 @@ export type AttachmentUpdateOneRequiredWithoutMessageNestedInput = {
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.AttachmentUpdateToOneWithWhereWithoutMessageInput, Prisma.AttachmentUpdateWithoutMessageInput>, Prisma.AttachmentUncheckedUpdateWithoutMessageInput>
|
||||
}
|
||||
|
||||
export type AttachmentCreateWithoutUserInput = {
|
||||
id?: string
|
||||
name: string
|
||||
mimetype: string
|
||||
size: number
|
||||
createdAt?: Date | string
|
||||
message?: Prisma.MessageAttachmentCreateNestedManyWithoutAttachmentInput
|
||||
}
|
||||
|
||||
export type AttachmentUncheckedCreateWithoutUserInput = {
|
||||
id?: string
|
||||
name: string
|
||||
mimetype: string
|
||||
size: number
|
||||
createdAt?: Date | string
|
||||
message?: Prisma.MessageAttachmentUncheckedCreateNestedManyWithoutAttachmentInput
|
||||
}
|
||||
|
||||
export type AttachmentCreateOrConnectWithoutUserInput = {
|
||||
where: Prisma.AttachmentWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.AttachmentCreateWithoutUserInput, Prisma.AttachmentUncheckedCreateWithoutUserInput>
|
||||
}
|
||||
|
||||
export type AttachmentCreateManyUserInputEnvelope = {
|
||||
data: Prisma.AttachmentCreateManyUserInput | Prisma.AttachmentCreateManyUserInput[]
|
||||
}
|
||||
|
||||
export type AttachmentUpsertWithWhereUniqueWithoutUserInput = {
|
||||
where: Prisma.AttachmentWhereUniqueInput
|
||||
update: Prisma.XOR<Prisma.AttachmentUpdateWithoutUserInput, Prisma.AttachmentUncheckedUpdateWithoutUserInput>
|
||||
create: Prisma.XOR<Prisma.AttachmentCreateWithoutUserInput, Prisma.AttachmentUncheckedCreateWithoutUserInput>
|
||||
}
|
||||
|
||||
export type AttachmentUpdateWithWhereUniqueWithoutUserInput = {
|
||||
where: Prisma.AttachmentWhereUniqueInput
|
||||
data: Prisma.XOR<Prisma.AttachmentUpdateWithoutUserInput, Prisma.AttachmentUncheckedUpdateWithoutUserInput>
|
||||
}
|
||||
|
||||
export type AttachmentUpdateManyWithWhereWithoutUserInput = {
|
||||
where: Prisma.AttachmentScalarWhereInput
|
||||
data: Prisma.XOR<Prisma.AttachmentUpdateManyMutationInput, Prisma.AttachmentUncheckedUpdateManyWithoutUserInput>
|
||||
}
|
||||
|
||||
export type AttachmentScalarWhereInput = {
|
||||
AND?: Prisma.AttachmentScalarWhereInput | Prisma.AttachmentScalarWhereInput[]
|
||||
OR?: Prisma.AttachmentScalarWhereInput[]
|
||||
NOT?: Prisma.AttachmentScalarWhereInput | Prisma.AttachmentScalarWhereInput[]
|
||||
id?: Prisma.StringFilter<"Attachment"> | string
|
||||
username?: Prisma.StringNullableFilter<"Attachment"> | string | null
|
||||
name?: Prisma.StringFilter<"Attachment"> | string
|
||||
mimetype?: Prisma.StringFilter<"Attachment"> | string
|
||||
size?: Prisma.IntFilter<"Attachment"> | number
|
||||
createdAt?: Prisma.DateTimeFilter<"Attachment"> | Date | string
|
||||
}
|
||||
|
||||
export type AttachmentCreateWithoutMessageInput = {
|
||||
id?: string
|
||||
name: string
|
||||
mimetype: string
|
||||
size: number
|
||||
createdAt?: Date | string
|
||||
user?: Prisma.UserCreateNestedOneWithoutAttachmentsInput
|
||||
}
|
||||
|
||||
export type AttachmentUncheckedCreateWithoutMessageInput = {
|
||||
id?: string
|
||||
username?: string | null
|
||||
name: string
|
||||
mimetype: string
|
||||
size: number
|
||||
@@ -421,9 +554,45 @@ export type AttachmentUpdateWithoutMessageInput = {
|
||||
mimetype?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
size?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
user?: Prisma.UserUpdateOneWithoutAttachmentsNestedInput
|
||||
}
|
||||
|
||||
export type AttachmentUncheckedUpdateWithoutMessageInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
username?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
mimetype?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
size?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type AttachmentCreateManyUserInput = {
|
||||
id?: string
|
||||
name: string
|
||||
mimetype: string
|
||||
size: number
|
||||
createdAt?: Date | string
|
||||
}
|
||||
|
||||
export type AttachmentUpdateWithoutUserInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
mimetype?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
size?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
message?: Prisma.MessageAttachmentUpdateManyWithoutAttachmentNestedInput
|
||||
}
|
||||
|
||||
export type AttachmentUncheckedUpdateWithoutUserInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
mimetype?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
size?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
message?: Prisma.MessageAttachmentUncheckedUpdateManyWithoutAttachmentNestedInput
|
||||
}
|
||||
|
||||
export type AttachmentUncheckedUpdateManyWithoutUserInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
mimetype?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -464,53 +633,67 @@ export type AttachmentCountOutputTypeCountMessageArgs<ExtArgs extends runtime.Ty
|
||||
|
||||
export type AttachmentSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
username?: boolean
|
||||
name?: boolean
|
||||
mimetype?: boolean
|
||||
size?: boolean
|
||||
createdAt?: boolean
|
||||
user?: boolean | Prisma.Attachment$userArgs<ExtArgs>
|
||||
message?: boolean | Prisma.Attachment$messageArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.AttachmentCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["attachment"]>
|
||||
|
||||
export type AttachmentSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
username?: boolean
|
||||
name?: boolean
|
||||
mimetype?: boolean
|
||||
size?: boolean
|
||||
createdAt?: boolean
|
||||
user?: boolean | Prisma.Attachment$userArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["attachment"]>
|
||||
|
||||
export type AttachmentSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
username?: boolean
|
||||
name?: boolean
|
||||
mimetype?: boolean
|
||||
size?: boolean
|
||||
createdAt?: boolean
|
||||
user?: boolean | Prisma.Attachment$userArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["attachment"]>
|
||||
|
||||
export type AttachmentSelectScalar = {
|
||||
id?: boolean
|
||||
username?: boolean
|
||||
name?: boolean
|
||||
mimetype?: boolean
|
||||
size?: boolean
|
||||
createdAt?: boolean
|
||||
}
|
||||
|
||||
export type AttachmentOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "mimetype" | "size" | "createdAt", ExtArgs["result"]["attachment"]>
|
||||
export type AttachmentOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "username" | "name" | "mimetype" | "size" | "createdAt", ExtArgs["result"]["attachment"]>
|
||||
export type AttachmentInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
user?: boolean | Prisma.Attachment$userArgs<ExtArgs>
|
||||
message?: boolean | Prisma.Attachment$messageArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.AttachmentCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
export type AttachmentIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {}
|
||||
export type AttachmentIncludeUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {}
|
||||
export type AttachmentIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
user?: boolean | Prisma.Attachment$userArgs<ExtArgs>
|
||||
}
|
||||
export type AttachmentIncludeUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
user?: boolean | Prisma.Attachment$userArgs<ExtArgs>
|
||||
}
|
||||
|
||||
export type $AttachmentPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
name: "Attachment"
|
||||
objects: {
|
||||
user: Prisma.$UserPayload<ExtArgs> | null
|
||||
message: Prisma.$MessageAttachmentPayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
username: string | null
|
||||
name: string
|
||||
mimetype: string
|
||||
size: number
|
||||
@@ -909,6 +1092,7 @@ readonly fields: AttachmentFieldRefs;
|
||||
*/
|
||||
export interface Prisma__AttachmentClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
user<T extends Prisma.Attachment$userArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Attachment$userArgs<ExtArgs>>): Prisma.Prisma__UserClient<runtime.Types.Result.GetResult<Prisma.$UserPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
message<T extends Prisma.Attachment$messageArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Attachment$messageArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$MessageAttachmentPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
@@ -940,6 +1124,7 @@ export interface Prisma__AttachmentClient<T, Null = never, ExtArgs extends runti
|
||||
*/
|
||||
export interface AttachmentFieldRefs {
|
||||
readonly id: Prisma.FieldRef<"Attachment", 'String'>
|
||||
readonly username: Prisma.FieldRef<"Attachment", 'String'>
|
||||
readonly name: Prisma.FieldRef<"Attachment", 'String'>
|
||||
readonly mimetype: Prisma.FieldRef<"Attachment", 'String'>
|
||||
readonly size: Prisma.FieldRef<"Attachment", 'Int'>
|
||||
@@ -1196,6 +1381,10 @@ export type AttachmentCreateManyAndReturnArgs<ExtArgs extends runtime.Types.Exte
|
||||
* The data used to create many Attachments.
|
||||
*/
|
||||
data: Prisma.AttachmentCreateManyInput | Prisma.AttachmentCreateManyInput[]
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.AttachmentIncludeCreateManyAndReturn<ExtArgs> | null
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1266,6 +1455,10 @@ export type AttachmentUpdateManyAndReturnArgs<ExtArgs extends runtime.Types.Exte
|
||||
* Limit how many Attachments to update.
|
||||
*/
|
||||
limit?: number
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.AttachmentIncludeUpdateManyAndReturn<ExtArgs> | null
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1334,6 +1527,25 @@ export type AttachmentDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.In
|
||||
limit?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Attachment.user
|
||||
*/
|
||||
export type Attachment$userArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the User
|
||||
*/
|
||||
select?: Prisma.UserSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the User
|
||||
*/
|
||||
omit?: Prisma.UserOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.UserInclude<ExtArgs> | null
|
||||
where?: Prisma.UserWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* Attachment.message
|
||||
*/
|
||||
|
||||
@@ -182,6 +182,7 @@ export type UserWhereInput = {
|
||||
displayName?: Prisma.StringFilter<"User"> | string
|
||||
createdAt?: Prisma.DateTimeFilter<"User"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string
|
||||
Attachments?: Prisma.AttachmentListRelationFilter
|
||||
Session?: Prisma.SessionListRelationFilter
|
||||
UserPreferences?: Prisma.XOR<Prisma.UserPreferencesNullableScalarRelationFilter, Prisma.UserPreferencesWhereInput> | null
|
||||
Messages?: Prisma.MessageListRelationFilter
|
||||
@@ -194,6 +195,7 @@ export type UserOrderByWithRelationInput = {
|
||||
displayName?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
Attachments?: Prisma.AttachmentOrderByRelationAggregateInput
|
||||
Session?: Prisma.SessionOrderByRelationAggregateInput
|
||||
UserPreferences?: Prisma.UserPreferencesOrderByWithRelationInput
|
||||
Messages?: Prisma.MessageOrderByRelationAggregateInput
|
||||
@@ -209,6 +211,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{
|
||||
displayName?: Prisma.StringFilter<"User"> | string
|
||||
createdAt?: Prisma.DateTimeFilter<"User"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string
|
||||
Attachments?: Prisma.AttachmentListRelationFilter
|
||||
Session?: Prisma.SessionListRelationFilter
|
||||
UserPreferences?: Prisma.XOR<Prisma.UserPreferencesNullableScalarRelationFilter, Prisma.UserPreferencesWhereInput> | null
|
||||
Messages?: Prisma.MessageListRelationFilter
|
||||
@@ -243,6 +246,7 @@ export type UserCreateInput = {
|
||||
displayName: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
Attachments?: Prisma.AttachmentCreateNestedManyWithoutUserInput
|
||||
Session?: Prisma.SessionCreateNestedManyWithoutUserInput
|
||||
UserPreferences?: Prisma.UserPreferencesCreateNestedOneWithoutUserInput
|
||||
Messages?: Prisma.MessageCreateNestedManyWithoutSenderInput
|
||||
@@ -255,6 +259,7 @@ export type UserUncheckedCreateInput = {
|
||||
displayName: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
Attachments?: Prisma.AttachmentUncheckedCreateNestedManyWithoutUserInput
|
||||
Session?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
|
||||
UserPreferences?: Prisma.UserPreferencesUncheckedCreateNestedOneWithoutUserInput
|
||||
Messages?: Prisma.MessageUncheckedCreateNestedManyWithoutSenderInput
|
||||
@@ -267,6 +272,7 @@ export type UserUpdateInput = {
|
||||
displayName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
Attachments?: Prisma.AttachmentUpdateManyWithoutUserNestedInput
|
||||
Session?: Prisma.SessionUpdateManyWithoutUserNestedInput
|
||||
UserPreferences?: Prisma.UserPreferencesUpdateOneWithoutUserNestedInput
|
||||
Messages?: Prisma.MessageUpdateManyWithoutSenderNestedInput
|
||||
@@ -279,6 +285,7 @@ export type UserUncheckedUpdateInput = {
|
||||
displayName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
Attachments?: Prisma.AttachmentUncheckedUpdateManyWithoutUserNestedInput
|
||||
Session?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
|
||||
UserPreferences?: Prisma.UserPreferencesUncheckedUpdateOneWithoutUserNestedInput
|
||||
Messages?: Prisma.MessageUncheckedUpdateManyWithoutSenderNestedInput
|
||||
@@ -379,6 +386,22 @@ export type UserUpdateOneRequiredWithoutUserPreferencesNestedInput = {
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutUserPreferencesInput, Prisma.UserUpdateWithoutUserPreferencesInput>, Prisma.UserUncheckedUpdateWithoutUserPreferencesInput>
|
||||
}
|
||||
|
||||
export type UserCreateNestedOneWithoutAttachmentsInput = {
|
||||
create?: Prisma.XOR<Prisma.UserCreateWithoutAttachmentsInput, Prisma.UserUncheckedCreateWithoutAttachmentsInput>
|
||||
connectOrCreate?: Prisma.UserCreateOrConnectWithoutAttachmentsInput
|
||||
connect?: Prisma.UserWhereUniqueInput
|
||||
}
|
||||
|
||||
export type UserUpdateOneWithoutAttachmentsNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.UserCreateWithoutAttachmentsInput, Prisma.UserUncheckedCreateWithoutAttachmentsInput>
|
||||
connectOrCreate?: Prisma.UserCreateOrConnectWithoutAttachmentsInput
|
||||
upsert?: Prisma.UserUpsertWithoutAttachmentsInput
|
||||
disconnect?: Prisma.UserWhereInput | boolean
|
||||
delete?: Prisma.UserWhereInput | boolean
|
||||
connect?: Prisma.UserWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutAttachmentsInput, Prisma.UserUpdateWithoutAttachmentsInput>, Prisma.UserUncheckedUpdateWithoutAttachmentsInput>
|
||||
}
|
||||
|
||||
export type UserCreateNestedOneWithoutMessagesInput = {
|
||||
create?: Prisma.XOR<Prisma.UserCreateWithoutMessagesInput, Prisma.UserUncheckedCreateWithoutMessagesInput>
|
||||
connectOrCreate?: Prisma.UserCreateOrConnectWithoutMessagesInput
|
||||
@@ -417,6 +440,7 @@ export type UserCreateWithoutSessionInput = {
|
||||
displayName: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
Attachments?: Prisma.AttachmentCreateNestedManyWithoutUserInput
|
||||
UserPreferences?: Prisma.UserPreferencesCreateNestedOneWithoutUserInput
|
||||
Messages?: Prisma.MessageCreateNestedManyWithoutSenderInput
|
||||
Channels?: Prisma.ChannelCreateNestedManyWithoutOwnerInput
|
||||
@@ -428,6 +452,7 @@ export type UserUncheckedCreateWithoutSessionInput = {
|
||||
displayName: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
Attachments?: Prisma.AttachmentUncheckedCreateNestedManyWithoutUserInput
|
||||
UserPreferences?: Prisma.UserPreferencesUncheckedCreateNestedOneWithoutUserInput
|
||||
Messages?: Prisma.MessageUncheckedCreateNestedManyWithoutSenderInput
|
||||
Channels?: Prisma.ChannelUncheckedCreateNestedManyWithoutOwnerInput
|
||||
@@ -455,6 +480,7 @@ export type UserUpdateWithoutSessionInput = {
|
||||
displayName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
Attachments?: Prisma.AttachmentUpdateManyWithoutUserNestedInput
|
||||
UserPreferences?: Prisma.UserPreferencesUpdateOneWithoutUserNestedInput
|
||||
Messages?: Prisma.MessageUpdateManyWithoutSenderNestedInput
|
||||
Channels?: Prisma.ChannelUpdateManyWithoutOwnerNestedInput
|
||||
@@ -466,6 +492,7 @@ export type UserUncheckedUpdateWithoutSessionInput = {
|
||||
displayName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
Attachments?: Prisma.AttachmentUncheckedUpdateManyWithoutUserNestedInput
|
||||
UserPreferences?: Prisma.UserPreferencesUncheckedUpdateOneWithoutUserNestedInput
|
||||
Messages?: Prisma.MessageUncheckedUpdateManyWithoutSenderNestedInput
|
||||
Channels?: Prisma.ChannelUncheckedUpdateManyWithoutOwnerNestedInput
|
||||
@@ -477,6 +504,7 @@ export type UserCreateWithoutUserPreferencesInput = {
|
||||
displayName: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
Attachments?: Prisma.AttachmentCreateNestedManyWithoutUserInput
|
||||
Session?: Prisma.SessionCreateNestedManyWithoutUserInput
|
||||
Messages?: Prisma.MessageCreateNestedManyWithoutSenderInput
|
||||
Channels?: Prisma.ChannelCreateNestedManyWithoutOwnerInput
|
||||
@@ -488,6 +516,7 @@ export type UserUncheckedCreateWithoutUserPreferencesInput = {
|
||||
displayName: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
Attachments?: Prisma.AttachmentUncheckedCreateNestedManyWithoutUserInput
|
||||
Session?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
|
||||
Messages?: Prisma.MessageUncheckedCreateNestedManyWithoutSenderInput
|
||||
Channels?: Prisma.ChannelUncheckedCreateNestedManyWithoutOwnerInput
|
||||
@@ -515,6 +544,7 @@ export type UserUpdateWithoutUserPreferencesInput = {
|
||||
displayName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
Attachments?: Prisma.AttachmentUpdateManyWithoutUserNestedInput
|
||||
Session?: Prisma.SessionUpdateManyWithoutUserNestedInput
|
||||
Messages?: Prisma.MessageUpdateManyWithoutSenderNestedInput
|
||||
Channels?: Prisma.ChannelUpdateManyWithoutOwnerNestedInput
|
||||
@@ -526,17 +556,83 @@ export type UserUncheckedUpdateWithoutUserPreferencesInput = {
|
||||
displayName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
Attachments?: Prisma.AttachmentUncheckedUpdateManyWithoutUserNestedInput
|
||||
Session?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
|
||||
Messages?: Prisma.MessageUncheckedUpdateManyWithoutSenderNestedInput
|
||||
Channels?: Prisma.ChannelUncheckedUpdateManyWithoutOwnerNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAttachmentsInput = {
|
||||
username: string
|
||||
password: string
|
||||
displayName: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
Session?: Prisma.SessionCreateNestedManyWithoutUserInput
|
||||
UserPreferences?: Prisma.UserPreferencesCreateNestedOneWithoutUserInput
|
||||
Messages?: Prisma.MessageCreateNestedManyWithoutSenderInput
|
||||
Channels?: Prisma.ChannelCreateNestedManyWithoutOwnerInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAttachmentsInput = {
|
||||
username: string
|
||||
password: string
|
||||
displayName: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
Session?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
|
||||
UserPreferences?: Prisma.UserPreferencesUncheckedCreateNestedOneWithoutUserInput
|
||||
Messages?: Prisma.MessageUncheckedCreateNestedManyWithoutSenderInput
|
||||
Channels?: Prisma.ChannelUncheckedCreateNestedManyWithoutOwnerInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAttachmentsInput = {
|
||||
where: Prisma.UserWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.UserCreateWithoutAttachmentsInput, Prisma.UserUncheckedCreateWithoutAttachmentsInput>
|
||||
}
|
||||
|
||||
export type UserUpsertWithoutAttachmentsInput = {
|
||||
update: Prisma.XOR<Prisma.UserUpdateWithoutAttachmentsInput, Prisma.UserUncheckedUpdateWithoutAttachmentsInput>
|
||||
create: Prisma.XOR<Prisma.UserCreateWithoutAttachmentsInput, Prisma.UserUncheckedCreateWithoutAttachmentsInput>
|
||||
where?: Prisma.UserWhereInput
|
||||
}
|
||||
|
||||
export type UserUpdateToOneWithWhereWithoutAttachmentsInput = {
|
||||
where?: Prisma.UserWhereInput
|
||||
data: Prisma.XOR<Prisma.UserUpdateWithoutAttachmentsInput, Prisma.UserUncheckedUpdateWithoutAttachmentsInput>
|
||||
}
|
||||
|
||||
export type UserUpdateWithoutAttachmentsInput = {
|
||||
username?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
password?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
displayName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
Session?: Prisma.SessionUpdateManyWithoutUserNestedInput
|
||||
UserPreferences?: Prisma.UserPreferencesUpdateOneWithoutUserNestedInput
|
||||
Messages?: Prisma.MessageUpdateManyWithoutSenderNestedInput
|
||||
Channels?: Prisma.ChannelUpdateManyWithoutOwnerNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAttachmentsInput = {
|
||||
username?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
password?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
displayName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
Session?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
|
||||
UserPreferences?: Prisma.UserPreferencesUncheckedUpdateOneWithoutUserNestedInput
|
||||
Messages?: Prisma.MessageUncheckedUpdateManyWithoutSenderNestedInput
|
||||
Channels?: Prisma.ChannelUncheckedUpdateManyWithoutOwnerNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutMessagesInput = {
|
||||
username: string
|
||||
password: string
|
||||
displayName: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
Attachments?: Prisma.AttachmentCreateNestedManyWithoutUserInput
|
||||
Session?: Prisma.SessionCreateNestedManyWithoutUserInput
|
||||
UserPreferences?: Prisma.UserPreferencesCreateNestedOneWithoutUserInput
|
||||
Channels?: Prisma.ChannelCreateNestedManyWithoutOwnerInput
|
||||
@@ -548,6 +644,7 @@ export type UserUncheckedCreateWithoutMessagesInput = {
|
||||
displayName: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
Attachments?: Prisma.AttachmentUncheckedCreateNestedManyWithoutUserInput
|
||||
Session?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
|
||||
UserPreferences?: Prisma.UserPreferencesUncheckedCreateNestedOneWithoutUserInput
|
||||
Channels?: Prisma.ChannelUncheckedCreateNestedManyWithoutOwnerInput
|
||||
@@ -575,6 +672,7 @@ export type UserUpdateWithoutMessagesInput = {
|
||||
displayName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
Attachments?: Prisma.AttachmentUpdateManyWithoutUserNestedInput
|
||||
Session?: Prisma.SessionUpdateManyWithoutUserNestedInput
|
||||
UserPreferences?: Prisma.UserPreferencesUpdateOneWithoutUserNestedInput
|
||||
Channels?: Prisma.ChannelUpdateManyWithoutOwnerNestedInput
|
||||
@@ -586,6 +684,7 @@ export type UserUncheckedUpdateWithoutMessagesInput = {
|
||||
displayName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
Attachments?: Prisma.AttachmentUncheckedUpdateManyWithoutUserNestedInput
|
||||
Session?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
|
||||
UserPreferences?: Prisma.UserPreferencesUncheckedUpdateOneWithoutUserNestedInput
|
||||
Channels?: Prisma.ChannelUncheckedUpdateManyWithoutOwnerNestedInput
|
||||
@@ -597,6 +696,7 @@ export type UserCreateWithoutChannelsInput = {
|
||||
displayName: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
Attachments?: Prisma.AttachmentCreateNestedManyWithoutUserInput
|
||||
Session?: Prisma.SessionCreateNestedManyWithoutUserInput
|
||||
UserPreferences?: Prisma.UserPreferencesCreateNestedOneWithoutUserInput
|
||||
Messages?: Prisma.MessageCreateNestedManyWithoutSenderInput
|
||||
@@ -608,6 +708,7 @@ export type UserUncheckedCreateWithoutChannelsInput = {
|
||||
displayName: string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
Attachments?: Prisma.AttachmentUncheckedCreateNestedManyWithoutUserInput
|
||||
Session?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
|
||||
UserPreferences?: Prisma.UserPreferencesUncheckedCreateNestedOneWithoutUserInput
|
||||
Messages?: Prisma.MessageUncheckedCreateNestedManyWithoutSenderInput
|
||||
@@ -635,6 +736,7 @@ export type UserUpdateWithoutChannelsInput = {
|
||||
displayName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
Attachments?: Prisma.AttachmentUpdateManyWithoutUserNestedInput
|
||||
Session?: Prisma.SessionUpdateManyWithoutUserNestedInput
|
||||
UserPreferences?: Prisma.UserPreferencesUpdateOneWithoutUserNestedInput
|
||||
Messages?: Prisma.MessageUpdateManyWithoutSenderNestedInput
|
||||
@@ -646,6 +748,7 @@ export type UserUncheckedUpdateWithoutChannelsInput = {
|
||||
displayName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
Attachments?: Prisma.AttachmentUncheckedUpdateManyWithoutUserNestedInput
|
||||
Session?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
|
||||
UserPreferences?: Prisma.UserPreferencesUncheckedUpdateOneWithoutUserNestedInput
|
||||
Messages?: Prisma.MessageUncheckedUpdateManyWithoutSenderNestedInput
|
||||
@@ -657,12 +760,14 @@ export type UserUncheckedUpdateWithoutChannelsInput = {
|
||||
*/
|
||||
|
||||
export type UserCountOutputType = {
|
||||
Attachments: number
|
||||
Session: number
|
||||
Messages: number
|
||||
Channels: number
|
||||
}
|
||||
|
||||
export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
Attachments?: boolean | UserCountOutputTypeCountAttachmentsArgs
|
||||
Session?: boolean | UserCountOutputTypeCountSessionArgs
|
||||
Messages?: boolean | UserCountOutputTypeCountMessagesArgs
|
||||
Channels?: boolean | UserCountOutputTypeCountChannelsArgs
|
||||
@@ -678,6 +783,13 @@ export type UserCountOutputTypeDefaultArgs<ExtArgs extends runtime.Types.Extensi
|
||||
select?: Prisma.UserCountOutputTypeSelect<ExtArgs> | null
|
||||
}
|
||||
|
||||
/**
|
||||
* UserCountOutputType without action
|
||||
*/
|
||||
export type UserCountOutputTypeCountAttachmentsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.AttachmentWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* UserCountOutputType without action
|
||||
*/
|
||||
@@ -706,6 +818,7 @@ export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
|
||||
displayName?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
Attachments?: boolean | Prisma.User$AttachmentsArgs<ExtArgs>
|
||||
Session?: boolean | Prisma.User$SessionArgs<ExtArgs>
|
||||
UserPreferences?: boolean | Prisma.User$UserPreferencesArgs<ExtArgs>
|
||||
Messages?: boolean | Prisma.User$MessagesArgs<ExtArgs>
|
||||
@@ -739,6 +852,7 @@ export type UserSelectScalar = {
|
||||
|
||||
export type UserOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"username" | "password" | "displayName" | "createdAt" | "updatedAt", ExtArgs["result"]["user"]>
|
||||
export type UserInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
Attachments?: boolean | Prisma.User$AttachmentsArgs<ExtArgs>
|
||||
Session?: boolean | Prisma.User$SessionArgs<ExtArgs>
|
||||
UserPreferences?: boolean | Prisma.User$UserPreferencesArgs<ExtArgs>
|
||||
Messages?: boolean | Prisma.User$MessagesArgs<ExtArgs>
|
||||
@@ -751,6 +865,7 @@ export type UserIncludeUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensi
|
||||
export type $UserPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
name: "User"
|
||||
objects: {
|
||||
Attachments: Prisma.$AttachmentPayload<ExtArgs>[]
|
||||
Session: Prisma.$SessionPayload<ExtArgs>[]
|
||||
UserPreferences: Prisma.$UserPreferencesPayload<ExtArgs> | null
|
||||
Messages: Prisma.$MessagePayload<ExtArgs>[]
|
||||
@@ -1156,6 +1271,7 @@ readonly fields: UserFieldRefs;
|
||||
*/
|
||||
export interface Prisma__UserClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
Attachments<T extends Prisma.User$AttachmentsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$AttachmentsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AttachmentPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
Session<T extends Prisma.User$SessionArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$SessionArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SessionPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
UserPreferences<T extends Prisma.User$UserPreferencesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$UserPreferencesArgs<ExtArgs>>): Prisma.Prisma__UserPreferencesClient<runtime.Types.Result.GetResult<Prisma.$UserPreferencesPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
Messages<T extends Prisma.User$MessagesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$MessagesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$MessagePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
@@ -1584,6 +1700,30 @@ export type UserDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
limit?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* User.Attachments
|
||||
*/
|
||||
export type User$AttachmentsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the Attachment
|
||||
*/
|
||||
select?: Prisma.AttachmentSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the Attachment
|
||||
*/
|
||||
omit?: Prisma.AttachmentOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.AttachmentInclude<ExtArgs> | null
|
||||
where?: Prisma.AttachmentWhereInput
|
||||
orderBy?: Prisma.AttachmentOrderByWithRelationInput | Prisma.AttachmentOrderByWithRelationInput[]
|
||||
cursor?: Prisma.AttachmentWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.AttachmentScalarFieldEnum | Prisma.AttachmentScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* User.Session
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_Attachment" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"username" TEXT,
|
||||
"name" TEXT NOT NULL,
|
||||
"mimetype" TEXT NOT NULL,
|
||||
"size" INTEGER NOT NULL,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT "Attachment_username_fkey" FOREIGN KEY ("username") REFERENCES "User" ("username") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_Attachment" ("createdAt", "id", "mimetype", "name", "size") SELECT "createdAt", "id", "mimetype", "name", "size" FROM "Attachment";
|
||||
DROP TABLE "Attachment";
|
||||
ALTER TABLE "new_Attachment" RENAME TO "Attachment";
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
@@ -14,6 +14,7 @@ model User {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
Attachments Attachment[]
|
||||
Session Session[]
|
||||
UserPreferences UserPreferences?
|
||||
Messages Message[]
|
||||
@@ -38,11 +39,13 @@ model UserPreferences {
|
||||
|
||||
model Attachment {
|
||||
id String @id @default(uuid())
|
||||
username String?
|
||||
name String
|
||||
mimetype String
|
||||
size Int
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User? @relation(references: [username], fields: [username], onDelete: Cascade)
|
||||
message MessageAttachment[]
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
},
|
||||
},
|
||||
async (req, reply) => {
|
||||
const user = req.user!
|
||||
const data = await req.file()
|
||||
|
||||
if (!data) {
|
||||
@@ -36,6 +37,7 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
const meta = await fastify.prisma.attachment.create({
|
||||
data: {
|
||||
name: data.filename,
|
||||
username: user.username,
|
||||
mimetype: data.mimetype,
|
||||
size: 0,
|
||||
},
|
||||
@@ -47,13 +49,25 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
|
||||
|
||||
const filePath = path.join(process.cwd(), 'uploads', meta.id)
|
||||
|
||||
let fileSize = 0
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
const writeStream = fs.createWriteStream(filePath)
|
||||
data.file.pipe(writeStream)
|
||||
data.file.on('data', (chunk) => {
|
||||
fileSize += chunk.length
|
||||
})
|
||||
data.file.on('end', resolve)
|
||||
data.file.on('error', reject)
|
||||
})
|
||||
|
||||
await fastify.prisma.attachment.update({
|
||||
where: { id: meta.id },
|
||||
data: { size: fileSize },
|
||||
})
|
||||
|
||||
// await new Promise(resolve => setTimeout(resolve, Math.random() * 10000))
|
||||
|
||||
return meta.id
|
||||
},
|
||||
)
|
||||
|
||||
@@ -105,7 +105,12 @@ fastify.register(FastifyCors, {
|
||||
})
|
||||
|
||||
fastify.register(FastifyCookie)
|
||||
fastify.register(FastifyMultipart)
|
||||
fastify.register(FastifyMultipart, {
|
||||
limits: {
|
||||
files: 10,
|
||||
fileSize: 500 * 1024 * 1024,
|
||||
},
|
||||
})
|
||||
|
||||
fastify.register(FastifyAutoLoad, {
|
||||
dir: join(__dirname, 'plugins'),
|
||||
|
||||
Reference in New Issue
Block a user