Compare commits
5 Commits
5d45c9674f
...
refactor
| Author | SHA1 | Date | |
|---|---|---|---|
| ca8728c90c | |||
| 0dd9efb9fb | |||
| 3c885edc46 | |||
| 12ae0ae839 | |||
| d06892e990 |
@@ -20,6 +20,8 @@
|
||||
"@vueuse/core": "^14.3.0",
|
||||
"@zag-js/avatar": "^1.40.0",
|
||||
"@zag-js/collapsible": "^1.40.0",
|
||||
"@zag-js/dialog": "^1.41.1",
|
||||
"@zag-js/file-upload": "^1.41.0",
|
||||
"@zag-js/file-utils": "^1.40.0",
|
||||
"@zag-js/password-input": "^1.40.0",
|
||||
"@zag-js/toggle": "^1.40.0",
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
<Component :is="layoutComponent">
|
||||
<RouterView />
|
||||
</Component>
|
||||
|
||||
<ChadDialogContainer />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ChadDialogContainer from '@shared/components/ui/DialogContainer.vue'
|
||||
import DefaultLayout from '@shared/layouts/Default.vue'
|
||||
import { computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Device } from 'mediasoup-client'
|
||||
import { markRaw, watch } from 'vue'
|
||||
|
||||
const ICE_SERVERS: RTCIceServer[] = [
|
||||
{ urls: 'stun:stunserver2025.stunprotocol.org:3478' },
|
||||
{ urls: 'stun:stun.l.google.com:19302' },
|
||||
{ urls: 'stun:stun.l.google.com:5349' },
|
||||
{ urls: 'stun:stun1.l.google.com:3478' },
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useClients } from '@shared/composables/use-clients'
|
||||
import { useEventBus } from '@shared/composables/use-event-bus.ts'
|
||||
import { useSignaling } from '@shared/composables/use-signaling'
|
||||
import { watch, watchEffect } from 'vue'
|
||||
import { queryClient } from '../plugins/tanstack-query'
|
||||
|
||||
export default function () {
|
||||
const { authorized } = useAuth()
|
||||
@@ -33,8 +34,9 @@ export default function () {
|
||||
removeClient(socketId)
|
||||
})
|
||||
|
||||
socket.on('disconnect', () => {
|
||||
socket.on('disconnect', async () => {
|
||||
clearClients()
|
||||
await queryClient.resetQueries()
|
||||
})
|
||||
|
||||
socket.on('chat:new-message', (message: ChatMessage) => {
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
import type { FunctionPlugin } from 'vue'
|
||||
import { VueQueryPlugin } from '@tanstack/vue-query'
|
||||
import { QueryClient, VueQueryPlugin } from '@tanstack/vue-query'
|
||||
|
||||
export const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
retry: false,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
export default {
|
||||
install(app) {
|
||||
app.use(VueQueryPlugin, {})
|
||||
app.use(VueQueryPlugin, {
|
||||
queryClient,
|
||||
})
|
||||
},
|
||||
} as FunctionPlugin
|
||||
|
||||
19
new-client/src/entities/channel/api/mCreateChannel.ts
Normal file
19
new-client/src/entities/channel/api/mCreateChannel.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { Channel, CreateChannelPayload, ResponseError } from '@shared/api/generated-chad-api'
|
||||
import api from '@shared/api/client'
|
||||
import { useMutation, useQueryClient } from '@tanstack/vue-query'
|
||||
|
||||
export function mCreateChannel() {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation<Channel, ResponseError, CreateChannelPayload, Channel>({
|
||||
mutationFn: async (payload) => {
|
||||
const response = await api.chad.channelCreate(payload)
|
||||
|
||||
return response.data
|
||||
},
|
||||
|
||||
onSuccess: async () => {
|
||||
await queryClient.invalidateQueries({ queryKey: ['channel-list'] })
|
||||
},
|
||||
})
|
||||
}
|
||||
44
new-client/src/entities/channel/ui/CreateChannelDialog.vue
Normal file
44
new-client/src/entities/channel/ui/CreateChannelDialog.vue
Normal file
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<ChadDialog :id="DIALOG_ID" title="Create channel">
|
||||
<ChadInput v-model="name" label="Name" />
|
||||
|
||||
<template #actions>
|
||||
<ChadButton style="grid-column: 2" :disabled="!valid" :loading="submitting" @click="submit()">
|
||||
Create
|
||||
</ChadButton>
|
||||
</template>
|
||||
</ChadDialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ChadButton from '@shared/components/ui/Button.vue'
|
||||
import ChadDialog from '@shared/components/ui/Dialog.vue'
|
||||
import ChadInput from '@shared/components/ui/Input.vue'
|
||||
import { useDialogManager } from '@shared/composables/use-dialog.ts'
|
||||
import { computed, ref } from 'vue'
|
||||
import { mCreateChannel } from '@/entities/channel/api/mCreateChannel.ts'
|
||||
|
||||
const DIALOG_ID = 'create-channel'
|
||||
|
||||
const dialogManager = useDialogManager()
|
||||
|
||||
const { mutateAsync: createChannel, isPending: submitting } = mCreateChannel()
|
||||
|
||||
const name = ref('')
|
||||
|
||||
const valid = computed(() => {
|
||||
return name.value.trim().length > 0
|
||||
})
|
||||
|
||||
async function submit() {
|
||||
if (!valid.value)
|
||||
return
|
||||
|
||||
await createChannel({
|
||||
name: name.value,
|
||||
persistent: false,
|
||||
})
|
||||
|
||||
dialogManager.close(DIALOG_ID)
|
||||
}
|
||||
</script>
|
||||
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
|
||||
<template #actions>
|
||||
<ChadButton full type="submit" :disabled="!valid" :loading="submitting">
|
||||
<ChadButton full native-type="submit" :disabled="!valid" :loading="submitting">
|
||||
Let's go
|
||||
</ChadButton>
|
||||
</template>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</div>
|
||||
|
||||
<template #actions>
|
||||
<ChadButton full type="submit" :disabled="!valid" :loading="submitting">
|
||||
<ChadButton full native-type="submit" :disabled="!valid" :loading="submitting">
|
||||
Create an account
|
||||
</ChadButton>
|
||||
</template>
|
||||
|
||||
@@ -1,37 +1,60 @@
|
||||
<template>
|
||||
<button
|
||||
class="chad-button"
|
||||
:data-loading="loading || undefined"
|
||||
:data-disabled="disabled || undefined"
|
||||
:class="[
|
||||
bem.b(),
|
||||
bem.exp(!!type, bem.m(type!)),
|
||||
bem.is('icon-only', iconOnly),
|
||||
bem.is('loading', loading),
|
||||
bem.is('disabled', disabled),
|
||||
bem.is('full', full),
|
||||
]"
|
||||
:disabled="disabled"
|
||||
:type="type"
|
||||
:data-full="full || undefined"
|
||||
:type="nativeType"
|
||||
>
|
||||
<ChadSpinner v-if="loading" class="chad-button__spinner" />
|
||||
<slot v-else />
|
||||
|
||||
<template v-else>
|
||||
<Component :is="icon" v-if="icon" class="chad-button__icon" />
|
||||
|
||||
<span v-if="$slots.default">
|
||||
<slot />
|
||||
</span>
|
||||
</template>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Component } from 'vue'
|
||||
import ChadSpinner from '@shared/components/ui/Spinner.vue'
|
||||
import useBem from '@shared/composables/use-bem.ts'
|
||||
import { computed, useSlots } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'ChadButton',
|
||||
})
|
||||
|
||||
withDefaults(
|
||||
defineProps<Props>(),
|
||||
const props = withDefaults(
|
||||
defineProps<ChadButtonProps>(),
|
||||
{
|
||||
type: 'button',
|
||||
nativeType: 'button',
|
||||
},
|
||||
)
|
||||
|
||||
interface Props {
|
||||
export interface ChadButtonProps {
|
||||
loading?: boolean
|
||||
disabled?: boolean
|
||||
type?: 'button' | 'submit'
|
||||
type?: 'secondary'
|
||||
nativeType?: 'button' | 'submit'
|
||||
icon?: Component
|
||||
full?: boolean
|
||||
}
|
||||
|
||||
const slots = useSlots()
|
||||
const bem = useBem('chad-button')
|
||||
|
||||
const iconOnly = computed(() => {
|
||||
return !slots.default && props.icon
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@@ -41,7 +64,7 @@ interface Props {
|
||||
flex-shrink: 0;
|
||||
border: none;
|
||||
color: var(--ink);
|
||||
padding-inline: var(--space-3);
|
||||
padding: 0 var(--space-3);
|
||||
height: 44px;
|
||||
background-color: var(--yellow);
|
||||
font-weight: 700;
|
||||
@@ -50,10 +73,15 @@ interface Props {
|
||||
outline: var(--border-w) solid var(--ink);
|
||||
outline-offset: calc(var(--border-w) * -1);
|
||||
|
||||
&[data-full] {
|
||||
&.is-full:not(.is-icon-only) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&.is-icon-only {
|
||||
padding: 0;
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: var(--yellow-deep);
|
||||
@@ -64,16 +92,35 @@ interface Props {
|
||||
color: var(--yellow);
|
||||
}
|
||||
|
||||
&[data-disabled],
|
||||
&--secondary {
|
||||
background-color: var(--grey-1);
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: var(--grey-2);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: var(--grey-3);
|
||||
color: var(--ink);
|
||||
}
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
cursor: not-allowed;
|
||||
background-color: var(--grey-1);
|
||||
color: var(--grey-3);
|
||||
}
|
||||
|
||||
&[data-loading] {
|
||||
&.is-loading {
|
||||
background-color: var(--grey-1);
|
||||
cursor: wait;
|
||||
}
|
||||
|
||||
&__icon {
|
||||
&:not(:last-child) {
|
||||
margin-right: var(--space-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
<template>
|
||||
<Component :is="as" class="chad-card">
|
||||
<p v-if="title" class="chad-card__title">
|
||||
{{ title }}
|
||||
</p>
|
||||
<div v-if="title || description" class="chad-card__header">
|
||||
<p v-if="title" class="chad-card__title">
|
||||
{{ title }}
|
||||
</p>
|
||||
|
||||
<p v-if="description" class="chad-card__description">
|
||||
{{ description }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="chad-card__content">
|
||||
<slot />
|
||||
@@ -39,6 +45,7 @@ const slots = defineSlots<{
|
||||
interface Props {
|
||||
as?: string
|
||||
title?: string
|
||||
description?: string
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -51,13 +58,23 @@ interface Props {
|
||||
outline-offset: calc(var(--border-w) * -1);
|
||||
box-shadow: var(--shadow);
|
||||
|
||||
&__title {
|
||||
@include font-display-22;
|
||||
|
||||
&__header {
|
||||
margin-bottom: var(--space-6);
|
||||
}
|
||||
|
||||
&__title {
|
||||
@include font-display-22;
|
||||
}
|
||||
|
||||
&__description {
|
||||
margin-top: var(--space-2);
|
||||
color: var(--grey-3);
|
||||
}
|
||||
|
||||
&__actions {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: var(--space-3);
|
||||
margin-top: var(--space-6);
|
||||
}
|
||||
|
||||
|
||||
169
new-client/src/shared/components/ui/Dialog.vue
Normal file
169
new-client/src/shared/components/ui/Dialog.vue
Normal file
@@ -0,0 +1,169 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div :class="[bem.b()]">
|
||||
<Transition name="chad-dialog-overlay" appear>
|
||||
<div v-if="api.open" :class="bem.e('overlay')" v-bind="api.getBackdropProps()" />
|
||||
</Transition>
|
||||
|
||||
<Transition
|
||||
name="chad-dialog-content"
|
||||
appear
|
||||
@after-enter="emit('opened')"
|
||||
@before-leave="emit('beforeClose')"
|
||||
@after-leave="emit('closed')"
|
||||
>
|
||||
<div v-if="api.open" :class="bem.e('positioner')" v-bind="api.getPositionerProps()">
|
||||
<ChadCard
|
||||
:class="bem.e('content')"
|
||||
v-bind="api.getContentProps()"
|
||||
:title="title"
|
||||
:description="description"
|
||||
>
|
||||
<slot v-bind="{ close }" />
|
||||
|
||||
<template v-if="$slots.actions" #actions>
|
||||
<slot name="actions" v-bind="{ close }" />
|
||||
</template>
|
||||
|
||||
<template v-if="$slots.bottom" #bottom>
|
||||
<slot name="bottom" v-bind="{ close }" />
|
||||
</template>
|
||||
|
||||
<ChadButton v-bind="api.getCloseTriggerProps()" :icon="XIcon" :class="bem.e('close')" type="secondary" />
|
||||
</ChadCard>
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Props as DialogProps } from '@zag-js/dialog'
|
||||
import { XIcon } from '@lucide/vue'
|
||||
import ChadButton from '@shared/components/ui/Button.vue'
|
||||
import ChadCard from '@shared/components/ui/Card.vue'
|
||||
import useBem from '@shared/composables/use-bem.ts'
|
||||
import { useDialogManager } from '@shared/composables/use-dialog.ts'
|
||||
import { connect, machine } from '@zag-js/dialog'
|
||||
import { normalizeProps, useMachine } from '@zag-js/vue'
|
||||
import { computed, getCurrentInstance, onBeforeUnmount, onMounted } from 'vue'
|
||||
|
||||
export interface ChadDialogProps {
|
||||
id: string
|
||||
title: string
|
||||
description?: string
|
||||
closeOnEscape?: boolean
|
||||
closeOnInteractOutside?: boolean
|
||||
}
|
||||
|
||||
defineOptions({
|
||||
name: 'ChadDialog',
|
||||
})
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<ChadDialogProps>(),
|
||||
{
|
||||
closeOnEscape: true,
|
||||
closeOnInteractOutside: true,
|
||||
},
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
opened: []
|
||||
beforeClose: []
|
||||
closed: []
|
||||
}>()
|
||||
|
||||
const bem = useBem('chad-dialog')
|
||||
|
||||
const service = useMachine(machine, computed(() => {
|
||||
return {
|
||||
id: props.id,
|
||||
defaultOpen: true,
|
||||
closeOnEscape: props.closeOnEscape,
|
||||
closeOnInteractOutside: props.closeOnInteractOutside,
|
||||
} as DialogProps
|
||||
}))
|
||||
const api = computed(() => connect(service, normalizeProps))
|
||||
|
||||
const instance = getCurrentInstance()
|
||||
const manager = useDialogManager()
|
||||
|
||||
function close() {
|
||||
api.value.setOpen(false)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (!instance)
|
||||
return
|
||||
|
||||
manager.instances.push(instance)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
const index = manager.instances.findIndex(_instance => _instance === instance)
|
||||
|
||||
if (index === -1)
|
||||
return
|
||||
|
||||
manager.instances.splice(index, 1)
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
close,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.chad-dialog {
|
||||
&__overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background-color: color-mix(in srgb, var(--ink) 60%, transparent);
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
&__positioner {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
padding: var(--space-4);
|
||||
}
|
||||
|
||||
&__content {
|
||||
position: relative;
|
||||
margin: auto;
|
||||
width: 560px;
|
||||
}
|
||||
|
||||
&__close {
|
||||
position: absolute;
|
||||
bottom: calc(100% + var(--space-2));
|
||||
right: 0;
|
||||
//right: var(--space-6);
|
||||
//top: var(--space-6);
|
||||
}
|
||||
|
||||
&-overlay-enter-active,
|
||||
&-overlay-leave-active {
|
||||
transition: opacity 0.15s ease-out;
|
||||
}
|
||||
|
||||
&-overlay-enter-from,
|
||||
&-overlay-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
&-content-enter-active,
|
||||
&-content-leave-active {
|
||||
transition: 0.15s ease-out;
|
||||
transition-property: opacity, translate, scale;
|
||||
}
|
||||
|
||||
&-content-enter-from,
|
||||
&-content-leave-to {
|
||||
opacity: 0;
|
||||
scale: 0.99;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
17
new-client/src/shared/components/ui/DialogContainer.vue
Normal file
17
new-client/src/shared/components/ui/DialogContainer.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<Component :is="dialog.component" v-for="dialog in dialogs" v-bind="dialog.attrs" :id="dialog.id" :key="dialog.id">
|
||||
<template v-for="(slot, key) in dialog.slots" #[key] :key="key">
|
||||
<Component :is="slot" />
|
||||
</template>
|
||||
</Component>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useDialogManager } from '@shared/composables/use-dialog.ts'
|
||||
|
||||
defineOptions({
|
||||
name: 'ChadDialogContainer',
|
||||
})
|
||||
|
||||
const { dialogs } = useDialogManager()
|
||||
</script>
|
||||
@@ -9,7 +9,7 @@
|
||||
{{ label }}
|
||||
</label>
|
||||
|
||||
<input :id="inputId" v-model="modelValue" class="chad-input__input" :placeholder="placeholder" type="text">
|
||||
<input :id="inputId" v-model="modelValue" class="chad-input__input" :placeholder="placeholder" type="text" autocomplete="off">
|
||||
|
||||
<p v-if="helper" class="chad-input__helper">
|
||||
{{ helper }}
|
||||
|
||||
25
new-client/src/shared/components/ui/NotificationBadge.vue
Normal file
25
new-client/src/shared/components/ui/NotificationBadge.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<div class="chad-notification-badge">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.chad-notification-badge {
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 12px;
|
||||
aspect-ratio: 1;
|
||||
background-color: var(--yellow);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
38
new-client/src/shared/components/ui/ToBottom.vue
Normal file
38
new-client/src/shared/components/ui/ToBottom.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<button class="chad-to-bottom">
|
||||
<ArrowDown />
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ArrowDown } from '@lucide/vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'ChadToBottom',
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.chad-to-bottom {
|
||||
cursor: pointer;
|
||||
width: 40px;
|
||||
aspect-ratio: 1;
|
||||
text-align: center;
|
||||
line-height: 40px;
|
||||
outline: var(--border-w) solid var(--ink);
|
||||
outline-offset: calc(var(--border-w) * -1);
|
||||
border: none;
|
||||
background-color: var(--grey-1);
|
||||
padding: 0;
|
||||
box-shadow: var(--shadow-sm);
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: var(--grey-2);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: var(--grey-3);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
68
new-client/src/shared/composables/use-bem.ts
Normal file
68
new-client/src/shared/composables/use-bem.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
interface Options {
|
||||
block: string
|
||||
blockSuffix?: string
|
||||
element?: string
|
||||
modifier?: string
|
||||
}
|
||||
|
||||
function _bem(options: Options) {
|
||||
const { block, blockSuffix, element, modifier } = options
|
||||
|
||||
let cls = block
|
||||
|
||||
if (blockSuffix)
|
||||
cls += `-${blockSuffix}`
|
||||
|
||||
if (element)
|
||||
cls += `__${element}`
|
||||
|
||||
if (modifier)
|
||||
cls += `--${modifier}`
|
||||
|
||||
return cls
|
||||
}
|
||||
|
||||
function isTruthy(value: unknown): boolean {
|
||||
if (Array.isArray(value)) {
|
||||
return value.length > 0
|
||||
}
|
||||
else if (typeof value === 'object' && value !== null) {
|
||||
return Object.keys(value).length > 0
|
||||
}
|
||||
|
||||
return !!value
|
||||
}
|
||||
|
||||
export default (block: string) => {
|
||||
const b = (blockSuffix?: string) => _bem({ block, blockSuffix })
|
||||
const e = (element: string) => _bem({ block, element })
|
||||
const m = (modifier: string) => _bem({ block, modifier })
|
||||
|
||||
const be = (blockSuffix: string, element: string) => _bem({ block, blockSuffix, element })
|
||||
const em = (element: string, modifier: string) => _bem({ block, element, modifier })
|
||||
const bm = (blockSuffix: string, modifier: string) => _bem({ block, blockSuffix, modifier })
|
||||
|
||||
const bem = (blockSuffix: string, element: string, modifier: string) => _bem({ block, blockSuffix, element, modifier })
|
||||
|
||||
const is = (name: string, state: unknown) => isTruthy(state) ? `is-${name}` : ''
|
||||
const has = (name: string, state: unknown) => isTruthy(state) ? `has-${name}` : ''
|
||||
|
||||
const exp = (condition: boolean, trueState: string, falseState: string = '') => condition ? trueState : falseState
|
||||
|
||||
return {
|
||||
b,
|
||||
e,
|
||||
m,
|
||||
|
||||
be,
|
||||
em,
|
||||
bm,
|
||||
|
||||
bem,
|
||||
|
||||
is,
|
||||
has,
|
||||
|
||||
exp,
|
||||
}
|
||||
}
|
||||
69
new-client/src/shared/composables/use-dialog.ts
Normal file
69
new-client/src/shared/composables/use-dialog.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import type { Component, ComponentInternalInstance } from 'vue'
|
||||
import { createGlobalState } from '@vueuse/core'
|
||||
import { mergeProps, shallowReactive } from 'vue'
|
||||
|
||||
type ComponentAttrs = Record<string, any>
|
||||
|
||||
export interface UseDialogOptions {
|
||||
id: string
|
||||
component: Component
|
||||
attrs?: ComponentAttrs
|
||||
slots?: Record<string, Component>
|
||||
}
|
||||
|
||||
export const useDialogManager = createGlobalState(() => {
|
||||
const dialogs = shallowReactive<UseDialogOptions[]>([])
|
||||
const instances = shallowReactive<ComponentInternalInstance[]>([])
|
||||
|
||||
function close(id: UseDialogOptions['id']) {
|
||||
const instance = instances.find(instance => instance.props.id === id)
|
||||
|
||||
if (!instance?.exposed?.close || typeof instance.exposed.close !== 'function')
|
||||
return
|
||||
|
||||
instance.exposed.close()
|
||||
}
|
||||
|
||||
function closeAll() {
|
||||
for (const dialog of dialogs) {
|
||||
close(dialog.id)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
dialogs,
|
||||
instances,
|
||||
close,
|
||||
closeAll,
|
||||
}
|
||||
})
|
||||
|
||||
export function useDialog(options: UseDialogOptions) {
|
||||
const manager = useDialogManager()
|
||||
|
||||
const initialAttrs = mergeProps(options.attrs ?? {}, {
|
||||
onClosed: () => {
|
||||
const index = manager.dialogs.findIndex(dialog => options.id === dialog.id)
|
||||
|
||||
if (index === -1)
|
||||
return
|
||||
|
||||
manager.dialogs.splice(index, 1)
|
||||
},
|
||||
})
|
||||
|
||||
function open(openAttrs?: ComponentAttrs) {
|
||||
const attrs = mergeProps(initialAttrs, openAttrs ?? {})
|
||||
|
||||
manager.dialogs.push({ ...options, attrs })
|
||||
}
|
||||
|
||||
function close() {
|
||||
manager.close(options.id)
|
||||
}
|
||||
|
||||
return {
|
||||
open,
|
||||
close,
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,10 @@
|
||||
<!-- <ChadButton style="margin: var(--space-2);" @click="logout"> -->
|
||||
<!-- Logout -->
|
||||
<!-- </ChadButton> -->
|
||||
|
||||
<ChadButton style="margin: var(--space-2)" type="secondary" @click="createChannelDialog.open()">
|
||||
Create channel
|
||||
</ChadButton>
|
||||
<ControlPanel />
|
||||
</aside>
|
||||
|
||||
@@ -46,12 +50,15 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ChadButton from '@shared/components/ui/Button.vue'
|
||||
import { useApp } from '@shared/composables/use-app.js'
|
||||
import { useDialog } from '@shared/composables/use-dialog.ts'
|
||||
import { useMediasoup } from '@shared/composables/use-mediasoup.ts'
|
||||
import { useProducers } from '@shared/composables/use-producers.ts'
|
||||
import ChannelList from '@widgets/channel-list/ui/ChannelList.vue'
|
||||
import ControlPanel from '@widgets/control-panel/ui/ControlPanel.vue'
|
||||
import { watchEffect } from 'vue'
|
||||
import CreateChannelDialog from '@/entities/channel/ui/CreateChannelDialog.vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'DefaultLayout',
|
||||
@@ -62,6 +69,11 @@ const { version } = useApp()
|
||||
const { sendTransport } = useMediasoup()
|
||||
const { enableMic } = useProducers()
|
||||
|
||||
const createChannelDialog = useDialog({
|
||||
id: 'create-channel',
|
||||
component: CreateChannelDialog,
|
||||
})
|
||||
|
||||
watchEffect(() => {
|
||||
if (!sendTransport.value)
|
||||
return
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
--grey-2: #c9c6bd;
|
||||
--grey-3: #8a8a82;
|
||||
|
||||
--shadow-sm: 3px 3px 0 0 var(--ink);
|
||||
--shadow: 6px 6px 0 0 var(--ink);
|
||||
|
||||
--border-w: 2px;
|
||||
|
||||
@@ -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()
|
||||
},
|
||||
|
||||
42
new-client/src/widgets/chat/composables/use-chat-history.ts
Normal file
42
new-client/src/widgets/chat/composables/use-chat-history.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import type { ChatMessage } from '@shared/api/generated-chad-api.ts'
|
||||
import { useEventBus } from '@shared/composables/use-event-bus.ts'
|
||||
import { createGlobalState } from '@vueuse/core'
|
||||
import { computed, shallowRef, triggerRef } from 'vue'
|
||||
import { qChatMessages } from '../api/qChatMessages.ts'
|
||||
|
||||
export interface MessageGroup {
|
||||
senderUsername: string
|
||||
messages: ChatMessage[]
|
||||
}
|
||||
|
||||
export const useChatHistory = createGlobalState(() => {
|
||||
const eventBus = useEventBus()
|
||||
|
||||
const { data: messages, hasNextPage: hasMoreMessages, fetchNextPage: loadMoreMessages, isFetching } = qChatMessages()
|
||||
|
||||
const feedItems = shallowRef<ChatMessage[]>([])
|
||||
|
||||
eventBus.on('chat:new-message', (message: ChatMessage) => {
|
||||
feedItems.value.push(message)
|
||||
triggerRef(feedItems)
|
||||
})
|
||||
|
||||
const messageGroups = computed<MessageGroup[]>(() => {
|
||||
const all = [...(messages.value ?? []), ...feedItems.value]
|
||||
return all.reduce((groups, msg) => {
|
||||
const last = groups.at(-1)
|
||||
if (last?.senderUsername === msg.senderUsername)
|
||||
last.messages.push(msg)
|
||||
else
|
||||
groups.push({ senderUsername: msg.senderUsername, messages: [msg] })
|
||||
return groups
|
||||
}, [] as MessageGroup[])
|
||||
})
|
||||
|
||||
return {
|
||||
messageGroups,
|
||||
hasMoreMessages,
|
||||
loadMoreMessages,
|
||||
isFetching,
|
||||
}
|
||||
})
|
||||
@@ -15,9 +15,8 @@ export function useChatScroll(target: TemplateRef<HTMLElement>, options?: MaybeR
|
||||
end: false,
|
||||
})
|
||||
|
||||
watch(arrivedState, () => {
|
||||
console.log('arrived state', arrivedState)
|
||||
})
|
||||
let lastScrollHeight = 0
|
||||
let lastScrollTop = 0
|
||||
|
||||
watch(el, (el) => {
|
||||
if (!el)
|
||||
@@ -27,19 +26,49 @@ export function useChatScroll(target: TemplateRef<HTMLElement>, options?: MaybeR
|
||||
getArrivedState()
|
||||
}, { flush: 'post' })
|
||||
|
||||
useMutationObserver(el, () => {
|
||||
useMutationObserver(el, (mutations) => {
|
||||
if (arrivedState.start) {
|
||||
scrollToStart(true)
|
||||
}
|
||||
else {
|
||||
// const prepended = mutations.some(mutation => Array.from(mutation.addedNodes.values()).some(node => !!node.nextEle))
|
||||
// console.log('prepended', prepended)
|
||||
// for (const mutation of mutations) {
|
||||
// for (const node of mutation.addedNodes) {
|
||||
// console.log('added node', node, !!node.nextSibling)
|
||||
// if (node.nextSibling) {
|
||||
// // добавлено сверху/в середину
|
||||
// // el.value!.scrollTop += (node as HTMLElement).offsetHeight
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // for (const node of mutation.removedNodes) {
|
||||
// // // previousSibling/nextSibling здесь — это соседи на момент удаления
|
||||
// // if (mutation.previousSibling || mutation.nextSibling) {
|
||||
// // // удалено сверху/в середину — уменьшаем scrollTop
|
||||
// // el.value!.scrollTop -= (node as HTMLElement).offsetHeight
|
||||
// // }
|
||||
// // }
|
||||
// }
|
||||
|
||||
const heightDiff = el.value!.scrollHeight - lastScrollHeight
|
||||
// const scrollDiff = el.value!.scrollTop - lastScrollTop
|
||||
//
|
||||
// console.log('height', 'old', lastScrollHeight, 'new', el.value!.scrollHeight, 'diff', heightDiff)
|
||||
// console.log('scroll', 'old', lastScrollTop, 'new', el.value!.scrollTop, 'diff', scrollDiff)
|
||||
//
|
||||
el.value!.scrollTop += heightDiff
|
||||
}
|
||||
|
||||
getArrivedState()
|
||||
}, {
|
||||
childList: true,
|
||||
// subtree: true,
|
||||
subtree: true,
|
||||
})
|
||||
|
||||
useEventListener(el, 'scroll', () => {
|
||||
getArrivedState()
|
||||
lastScrollTop = el.value!.scrollTop
|
||||
}, { passive: true })
|
||||
|
||||
useEventListener(el, 'scrollend', () => {
|
||||
@@ -61,6 +90,8 @@ export function useChatScroll(target: TemplateRef<HTMLElement>, options?: MaybeR
|
||||
|
||||
arrivedState.start = scrollTop + offsetHeight >= scrollHeight - startOffset
|
||||
arrivedState.end = scrollTop <= endOffset
|
||||
|
||||
lastScrollHeight = el.value!.scrollHeight
|
||||
}
|
||||
|
||||
function scrollToStart(instant = false) {
|
||||
|
||||
@@ -1,24 +1,18 @@
|
||||
import type { ChatMessage } from '@shared/api/generated-chad-api.ts'
|
||||
import { useSignaling } from '@shared/composables/use-signaling'
|
||||
import { createGlobalState } from '@vueuse/core'
|
||||
import { shallowRef, triggerRef, watch } from 'vue'
|
||||
import { qChatMessages } from '../api/qChatMessages.ts'
|
||||
import type { NewChatMessagePayload } from '@shared/api/generated-chad-api.ts'
|
||||
import api from '@shared/api/client.ts'
|
||||
|
||||
export const useChat = createGlobalState(() => {
|
||||
const { data: messages, hasNextPage: hasMoreMessages, fetchNextPage, isFetching } = qChatMessages()
|
||||
export function useChat() {
|
||||
async function sendMessage(newMessage: NewChatMessagePayload) {
|
||||
newMessage.text = newMessage.text.trim()
|
||||
|
||||
const { socket, connected } = useSignaling()
|
||||
const feedItems = shallowRef<ChatMessage[]>([])
|
||||
|
||||
watch(connected, (isConnected) => {
|
||||
if (!isConnected)
|
||||
if (newMessage.attachments?.length === 0 && newMessage.text.length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
socket.value!.on('chat:new-message', (message: ChatMessage) => {
|
||||
feedItems.value.push(message)
|
||||
triggerRef(feedItems)
|
||||
})
|
||||
})
|
||||
await api.chad.chatSend(newMessage)
|
||||
}
|
||||
|
||||
return { messages, feedItems, hasMoreMessages, fetchNextPage, isFetching }
|
||||
})
|
||||
return {
|
||||
sendMessage,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
<template>
|
||||
<div class="chat">
|
||||
<ChatMessages class="chat__messages" />
|
||||
<!-- <ChadButton @click="loadMoreMessages()"> -->
|
||||
<!-- PENIS -->
|
||||
<!-- </ChadButton> -->
|
||||
<ChatInput class="chat__input" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useChatHistory } from '@widgets/chat/composables/use-chat-history.ts'
|
||||
import ChatInput from '@widgets/chat/ui/ChatInput.vue'
|
||||
import ChatMessages from '@widgets/chat/ui/ChatMessages.vue'
|
||||
|
||||
const { loadMoreMessages } = useChatHistory()
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
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>
|
||||
@@ -1,16 +1,181 @@
|
||||
<template>
|
||||
<div class="chat-input">
|
||||
<ChadInput placeholder="Write a message..." />
|
||||
<div class="chat-input" v-bind="fileUploadApi.getRootProps()">
|
||||
<div class="chat-input__input-row">
|
||||
<ChadButton
|
||||
class="chat-input__add-attachment"
|
||||
type="secondary"
|
||||
:icon="Plus"
|
||||
@click="fileUploadApi.openFilePicker()"
|
||||
/>
|
||||
|
||||
<ChadInput
|
||||
v-model="message.text"
|
||||
class="chat-input__input"
|
||||
placeholder="Write a message..."
|
||||
@keydown.enter="sendMessage()"
|
||||
/>
|
||||
|
||||
<ChadButton
|
||||
class="chat-input__send"
|
||||
:loading="isUploading"
|
||||
@click="sendMessage()"
|
||||
>
|
||||
Send
|
||||
</ChadButton>
|
||||
</div>
|
||||
|
||||
<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 })"
|
||||
:name="file.name"
|
||||
@click="removeFile(file)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<input v-bind="fileUploadApi.getHiddenInputProps()">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="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()
|
||||
|
||||
const message: NewChatMessagePayload = reactive({
|
||||
text: '',
|
||||
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: 1000 * 1024 * 1024,
|
||||
name: 'chat-input',
|
||||
capture: 'environment',
|
||||
allowDrop: false,
|
||||
onFileAccept: (details) => {
|
||||
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))
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
function reset() {
|
||||
message.text = ''
|
||||
message.attachments = []
|
||||
uploadStates.clear()
|
||||
fileUploadApi.value.clearFiles()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.chat-input {
|
||||
padding: var(--space-3) var(--space-6);
|
||||
border-top: var(--border-w) solid var(--ink);
|
||||
|
||||
&__input-row {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
&__add-attachment {
|
||||
flex-shrink: 0;
|
||||
margin-right: calc(var(--border-w) * -1);
|
||||
}
|
||||
|
||||
&__input {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&__send {
|
||||
flex-shrink: 0;
|
||||
margin-left: calc(var(--border-w) * -1);
|
||||
}
|
||||
|
||||
&__attachments {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-2);
|
||||
margin-top: var(--space-2);
|
||||
outline: var(--border-w) dashed var(--ink);
|
||||
outline-offset: calc(var(--border-w) * -1);
|
||||
overflow: hidden;
|
||||
|
||||
> * {
|
||||
max-width: 300px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,30 +1,25 @@
|
||||
<template>
|
||||
<div class="chat-message">
|
||||
<ChadAvatar class="chat-message__avatar" src="" :fallback="initials" :highlighted="isMyMessage" />
|
||||
<div>
|
||||
<div class="chat-message__top">
|
||||
<p class="chat-message__sender">
|
||||
{{ !sender ? message.senderUsername : sender.displayName }}
|
||||
</p>
|
||||
|
||||
<p class="chat-message__datetime">
|
||||
{{ datetime }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p class="chat-message__body">
|
||||
{{ message.text }}
|
||||
<div class="chat-message__top">
|
||||
<p class="chat-message__sender">
|
||||
{{ !sender ? message.senderUsername : sender.displayName }}
|
||||
</p>
|
||||
|
||||
<ChatMessageAttachments v-if="message.attachments.length > 0" :attachments="message.attachments" class="chat-message__attachments" />
|
||||
<p class="chat-message__datetime">
|
||||
{{ datetime }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p class="chat-message__body">
|
||||
{{ message.text }}
|
||||
</p>
|
||||
|
||||
<ChatMessageAttachments v-if="message.attachments.length > 0" :attachments="message.attachments" class="chat-message__attachments" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ChatMessage } from '@shared/api/generated-chad-api.ts'
|
||||
import ChadAvatar from '@shared/components/ui/Avatar.vue'
|
||||
import { useAuth } from '@shared/composables/use-auth.ts'
|
||||
import { useUserDetails } from '@shared/composables/use-user-details.ts'
|
||||
import ChatMessageAttachments from '@widgets/chat/ui/ChatMessageAttachments.vue'
|
||||
import { format, isThisYear, isToday } from 'date-fns'
|
||||
@@ -34,16 +29,8 @@ const props = defineProps<{
|
||||
message: ChatMessage
|
||||
}>()
|
||||
|
||||
const { me } = useAuth()
|
||||
|
||||
const isMyMessage = computed(() => {
|
||||
return props.message.senderUsername === me.value?.username
|
||||
})
|
||||
|
||||
const { user: sender } = useUserDetails(toRef(() => props.message.senderUsername))
|
||||
|
||||
const initials = computed(() => props.message.senderUsername.slice(props.message.senderUsername.length - 2))
|
||||
|
||||
const datetime = computed(() => {
|
||||
let formatStr = 'd MMMM yyyy, HH:mm'
|
||||
|
||||
@@ -62,27 +49,23 @@ const datetime = computed(() => {
|
||||
.chat-message {
|
||||
$self: &;
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
grid-template-areas: 'avatar top' 'avatar body';
|
||||
column-gap: var(--space-3);
|
||||
padding-block: var(--space-3);
|
||||
padding-inline: var(--space-6);
|
||||
|
||||
&__avatar {
|
||||
grid-area: avatar;
|
||||
&:not(:last-child) {
|
||||
margin-bottom: var(--space-3);
|
||||
}
|
||||
|
||||
&__top {
|
||||
display: flex;
|
||||
gap: var(--space-2);
|
||||
align-items: center;
|
||||
grid-area: top;
|
||||
//margin-top: var(--space-1);
|
||||
}
|
||||
|
||||
&__sender {
|
||||
@include font-body-bold;
|
||||
|
||||
#{$self}:not(:first-child) & {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&__datetime {
|
||||
@@ -93,7 +76,6 @@ const datetime = computed(() => {
|
||||
}
|
||||
|
||||
&__body {
|
||||
grid-area: body;
|
||||
margin-top: var(--space-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -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' })
|
||||
|
||||
@@ -39,6 +44,8 @@ async function download() {
|
||||
|
||||
<style lang="scss">
|
||||
.chat-message-attachment {
|
||||
$self: &;
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: 52px 1fr;
|
||||
outline: var(--border-w) solid var(--ink);
|
||||
@@ -46,13 +53,18 @@ async function download() {
|
||||
background-color: var(--grey-1);
|
||||
width: 300px;
|
||||
height: 52px;
|
||||
//overflow: hidden;
|
||||
|
||||
cursor: pointer;
|
||||
|
||||
&:focus,
|
||||
&:hover {
|
||||
background-color: var(--grey-2);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: var(--grey-3);
|
||||
}
|
||||
|
||||
&__extension {
|
||||
@include font-label;
|
||||
|
||||
@@ -68,6 +80,7 @@ async function download() {
|
||||
flex: 1;
|
||||
padding: var(--space-3);
|
||||
align-self: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&__name {
|
||||
@@ -86,6 +99,10 @@ async function download() {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
#{$self}:active & {
|
||||
color: var(--grey-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -31,21 +31,17 @@ const notImages = computed(() => {
|
||||
|
||||
<style lang="scss">
|
||||
.chat-message-attachments {
|
||||
> *:not(:last-child) {
|
||||
margin-bottom: var(--space-3);
|
||||
}
|
||||
overflow-x: auto;
|
||||
|
||||
&__images {
|
||||
&__images,
|
||||
&__list {
|
||||
display: flex;
|
||||
gap: var(--space-2);
|
||||
flex-wrap: nowrap;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
&__list {
|
||||
> *:not(:last-child) {
|
||||
margin-bottom: var(--space-2);
|
||||
}
|
||||
margin-top: var(--space-3);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { MessageGroup } from '@widgets/chat/composables/use-chat.ts'
|
||||
import type { MessageGroup } from '@widgets/chat/composables/use-chat-history.js'
|
||||
import ChadAvatar from '@shared/components/ui/Avatar.vue'
|
||||
import { useAuth } from '@shared/composables/use-auth.ts'
|
||||
import ChatMessage from '@widgets/chat/ui/ChatMessage.vue'
|
||||
@@ -41,7 +41,6 @@ const isMyMessage = computed(() => {
|
||||
padding-inline: var(--space-6);
|
||||
|
||||
&__avatar {
|
||||
align-self: flex-start;
|
||||
position: sticky;
|
||||
top: var(--space-3);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ const src = computed(() => {
|
||||
height: 160px;
|
||||
|
||||
> img {
|
||||
object-fit: contain;
|
||||
object-position: center;
|
||||
max-width: 260px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -1,32 +1,42 @@
|
||||
<template>
|
||||
<div class="chat-messages">
|
||||
<div v-if="messages" ref="scroll" class="chat-messages__list">
|
||||
<ChatMessage v-for="message in messages" :key="message.id" :message="message" />
|
||||
<ChatMessage v-for="item in feedItems" :key="item.id" :message="item" />
|
||||
<div v-if="messageGroups.length" ref="scroll" class="chat-messages__list">
|
||||
<ChatMessageGroup
|
||||
v-for="group in messageGroups"
|
||||
:key="`group-${group.messages[0].id}`"
|
||||
:group="group"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<ChadSpinner v-if="isFetching" class="chat-messages__spinner" />
|
||||
|
||||
<button v-if="!arrivedState.start" class="chat-messages__scroll-to-bottom" @click="scrollToStart()">
|
||||
<ArrowDown />
|
||||
</button>
|
||||
<div v-if="!arrivedState.start" class="chat-messages__floating-actions">
|
||||
<div v-if="hasUnreadMessages" class="chat-messages__has-unread-messages">
|
||||
New messages
|
||||
</div>
|
||||
|
||||
<ChadToBottom
|
||||
class="chat-messages__scroll-to-bottom"
|
||||
@click="scrollToStart()"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ArrowDown } from '@lucide/vue'
|
||||
import ChadSpinner from '@shared/components/ui/Spinner.vue'
|
||||
import ChadToBottom from '@shared/components/ui/ToBottom.vue'
|
||||
import { useEventBus } from '@shared/composables/use-event-bus.ts'
|
||||
import { useChatScroll } from '@widgets/chat/composables/use-chat-scroll.ts'
|
||||
import ChatMessage from '@widgets/chat/ui/ChatMessage.vue'
|
||||
import ChatMessageGroup from '@widgets/chat/ui/ChatMessageGroup.vue'
|
||||
import { onUnmounted, ref, useTemplateRef, watch } from 'vue'
|
||||
import { useChat } from '../composables/use-chat'
|
||||
import { useChatHistory } from '../composables/use-chat-history'
|
||||
|
||||
const eventBus = useEventBus()
|
||||
|
||||
const scrollRef = useTemplateRef('scroll')
|
||||
|
||||
const { messages, feedItems, hasMoreMessages, fetchNextPage, isFetching } = useChat()
|
||||
const { messageGroups, hasMoreMessages, loadMoreMessages, isFetching } = useChatHistory()
|
||||
|
||||
const hasUnreadMessages = ref(false)
|
||||
|
||||
@@ -40,7 +50,7 @@ watch(() => arrivedState.end, (arrived) => {
|
||||
return
|
||||
|
||||
if (hasMoreMessages.value) {
|
||||
fetchNextPage()
|
||||
loadMoreMessages()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -78,31 +88,32 @@ function onNewChatMessage() {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
overflow-y: overlay;
|
||||
overflow-anchor: none;
|
||||
|
||||
position: relative;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
&__scroll-to-bottom {
|
||||
&__floating-actions {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
width: 40px;
|
||||
aspect-ratio: 1;
|
||||
text-align: center;
|
||||
line-height: 40px;
|
||||
display: inline-flex;
|
||||
align-items: flex-end;
|
||||
gap: var(--space-2);
|
||||
bottom: var(--space-4);
|
||||
right: var(--space-4);
|
||||
outline: var(--border-w) solid var(--ink);
|
||||
outline-offset: calc(var(--border-w) * -1);
|
||||
border: none;
|
||||
background-color: var(--grey-1);
|
||||
padding: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&:active {
|
||||
background-color: var(--grey-2);
|
||||
}
|
||||
&__has-unread-messages {
|
||||
@include font-micro;
|
||||
|
||||
background-color: var(--yellow);
|
||||
padding: var(--space-1) var(--space-2);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
&__scroll-to-bottom {
|
||||
pointer-events: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1200,112 +1200,210 @@
|
||||
resolved "https://registry.yarnpkg.com/@vueuse/shared/-/shared-14.3.0.tgz#a3e7e6391f9ed7f363cbb28c32c4a278efaacbd0"
|
||||
integrity sha512-bZpge9eSXwa4ToSiqJ7j6KRwhAsneMFoSz3LMWKQDkqimm3D/tbFlrklrs/IOqC8tEcYmXQZJ6N0UrjhBirVCg==
|
||||
|
||||
"@zag-js/anatomy@1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/anatomy/-/anatomy-1.40.0.tgz#df087ed1a287d14bc99eca1e4a580fb68db04c5a"
|
||||
integrity sha512-oiB4uAaV//L38JluLVPtOHO3xvqambrfrXVOoq4kmNrBv1LLlCmFvrXA2HOR9lakn4ExK27XSUrKhUN7YlKjfQ==
|
||||
"@zag-js/anatomy@1.41.0":
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/anatomy/-/anatomy-1.41.0.tgz#af0d132a4470dcea93f857b1a12b6cc9c6d3b847"
|
||||
integrity sha512-0M/bWcYbWgM09HEhfU0GvpKgPt3I4vakjr21FHcjTNK2vYRC1oz2GHc/y9ArJa4jXe0piTiPbACzMK1/z2ukRw==
|
||||
|
||||
"@zag-js/anatomy@1.41.1":
|
||||
version "1.41.1"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/anatomy/-/anatomy-1.41.1.tgz#9cb2a4c6506fd14bbd3387e523885257ed1e37d9"
|
||||
integrity sha512-wBQVpl8TC9O5AjeJrnmNdJWEUYorTi7iklOcySeXIeaz6D7Y0YY0YbEOSFNsRTpn/NQHwkPejf3i5qkKavNHXw==
|
||||
|
||||
"@zag-js/aria-hidden@1.41.1":
|
||||
version "1.41.1"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/aria-hidden/-/aria-hidden-1.41.1.tgz#69c7c695c718baaaad4db9ae8ddae1c17d5bbfcb"
|
||||
integrity sha512-+iZ2gG/EygWQRfafcIL9MMgKIP9QCnW8SfxlO71FYEMrexvJyzxyPUxzBn2NfpH+gOogzLrr3lvPTYZu+0kCVQ==
|
||||
dependencies:
|
||||
"@zag-js/dom-query" "1.41.1"
|
||||
|
||||
"@zag-js/avatar@^1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/avatar/-/avatar-1.40.0.tgz#6d412fe7f7726f7924fcb6a46da397650f07987c"
|
||||
integrity sha512-DayZDsNXbipT+1GUkX29tVhO4hZonDnidwE3SjEQv9Ic9vCdnwP95+B0FPEuaca03F5ZXFqVXjnPmRVbRMyDYQ==
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/avatar/-/avatar-1.41.0.tgz#2505e32cba85d815845c7f5c07431e57a1b60d8a"
|
||||
integrity sha512-vsXNCyb7mDSSYELQ4MDwvtKKu8JhdF9FiC2bwbWxD8ubUUQscajPJ6Y6fLTIpxEx8h4B5St66RRDNuuirVRrXw==
|
||||
dependencies:
|
||||
"@zag-js/anatomy" "1.40.0"
|
||||
"@zag-js/core" "1.40.0"
|
||||
"@zag-js/dom-query" "1.40.0"
|
||||
"@zag-js/types" "1.40.0"
|
||||
"@zag-js/utils" "1.40.0"
|
||||
"@zag-js/anatomy" "1.41.0"
|
||||
"@zag-js/core" "1.41.0"
|
||||
"@zag-js/dom-query" "1.41.0"
|
||||
"@zag-js/types" "1.41.0"
|
||||
"@zag-js/utils" "1.41.0"
|
||||
|
||||
"@zag-js/collapsible@^1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/collapsible/-/collapsible-1.40.0.tgz#a8cf143963df8be1421ec5b3f3cbd76581c36f62"
|
||||
integrity sha512-xDLY4j9D3gdoTirkwzMaCtelfCjnMhBzPyY6c/mh4oPvD3RB6dr3V3kI80i3yxHaUUeDCIUm/XAxK0InPsRBug==
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/collapsible/-/collapsible-1.41.0.tgz#b9c0be046fb5df4b0915ed9522c1f1f037605878"
|
||||
integrity sha512-Zdo1RiwxzjuM3ZElpgSxsHAej3dRnCP6Jti0rIyM+EEE3CvKeFpprJFh0sjE7TW5PEuhey69Q9QhMjJbHFfNpg==
|
||||
dependencies:
|
||||
"@zag-js/anatomy" "1.40.0"
|
||||
"@zag-js/core" "1.40.0"
|
||||
"@zag-js/dom-query" "1.40.0"
|
||||
"@zag-js/types" "1.40.0"
|
||||
"@zag-js/utils" "1.40.0"
|
||||
"@zag-js/anatomy" "1.41.0"
|
||||
"@zag-js/core" "1.41.0"
|
||||
"@zag-js/dom-query" "1.41.0"
|
||||
"@zag-js/types" "1.41.0"
|
||||
"@zag-js/utils" "1.41.0"
|
||||
|
||||
"@zag-js/core@1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/core/-/core-1.40.0.tgz#0640fdda8611417fb88d5d2df65048dd2bd2b84b"
|
||||
integrity sha512-0YcqCh7TmhSonkbKM/7NWolxlaQgvvXgqedocW9oeRYiDJIpBZyRqnHPoGAS2XwbBPkCnrqSosxSF5yBjhZpgw==
|
||||
"@zag-js/core@1.41.0":
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/core/-/core-1.41.0.tgz#cba13f582b74ee221aca51686bb4e9b34843443e"
|
||||
integrity sha512-CkX9xjNCTlOLwJNRZs4+Rse+bPVQWaNmfSTGa7m0FRR4XWf66/bx5YTpHNTKKmPL8KWjHCvlvSeN6uHDeSBs/w==
|
||||
dependencies:
|
||||
"@zag-js/dom-query" "1.40.0"
|
||||
"@zag-js/utils" "1.40.0"
|
||||
"@zag-js/dom-query" "1.41.0"
|
||||
"@zag-js/utils" "1.41.0"
|
||||
|
||||
"@zag-js/dom-query@1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/dom-query/-/dom-query-1.40.0.tgz#f35d1de3d7050da2b758aee35cb42f9c1332d920"
|
||||
integrity sha512-4J3EO2gHpZ1VZiGLuMlH6G1Tsp4gKB8PPt2yKeNQWYGEXyrHUXrvMhRUzv7Z4/2I1s1tnxlFG4F8ovB3kTpz/Q==
|
||||
"@zag-js/core@1.41.1":
|
||||
version "1.41.1"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/core/-/core-1.41.1.tgz#c348c7b70753ac33967093c02c53d263400619df"
|
||||
integrity sha512-np7Tlf1EUK2ITojiX3aQy79LWIZhu4xxrS6pE8V/wD0h9JeQmhyNtyC147jqIE/AYjSunhMShsWp/+W1b5skjQ==
|
||||
dependencies:
|
||||
"@zag-js/types" "1.40.0"
|
||||
"@zag-js/dom-query" "1.41.1"
|
||||
"@zag-js/utils" "1.41.1"
|
||||
|
||||
"@zag-js/file-utils@^1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/file-utils/-/file-utils-1.40.0.tgz#65bfea43ff88c3534b79c1d880de9a6fc382fc8a"
|
||||
integrity sha512-BGny4rafiBQ5TPCBXfzbH7lSyFdnoix7brq/+FllKpDqpWPQz0tIsgSZueF/Z8GPTrAkwMKOFI99P7OVhAhRig==
|
||||
"@zag-js/dialog@^1.41.1":
|
||||
version "1.41.1"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/dialog/-/dialog-1.41.1.tgz#12d3e5e341064103184dbfeeb1e77c0f7f0036a6"
|
||||
integrity sha512-+++Ct5Kj2NtAHk1EYHasYPHXm1GfunwE0QKnrtEjUo1yIgKe2NH230JkXKndpiGztxcDpLfkblMuDwot1lNtFw==
|
||||
dependencies:
|
||||
"@zag-js/i18n-utils" "1.40.0"
|
||||
"@zag-js/anatomy" "1.41.1"
|
||||
"@zag-js/aria-hidden" "1.41.1"
|
||||
"@zag-js/core" "1.41.1"
|
||||
"@zag-js/dismissable" "1.41.1"
|
||||
"@zag-js/dom-query" "1.41.1"
|
||||
"@zag-js/focus-trap" "1.41.1"
|
||||
"@zag-js/remove-scroll" "1.41.1"
|
||||
"@zag-js/types" "1.41.1"
|
||||
"@zag-js/utils" "1.41.1"
|
||||
|
||||
"@zag-js/i18n-utils@1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/i18n-utils/-/i18n-utils-1.40.0.tgz#c85c5e6327715dc3a86fc2d677e15905c3b1f3aa"
|
||||
integrity sha512-8D3ki9V81gMKZvtRfNVoHCBDVYjr+WJLBvdfSv3cdOsVM2/E8//xAfYbYzl5Fdmeny3H71fxBNqOX05GN4K6OA==
|
||||
"@zag-js/dismissable@1.41.1":
|
||||
version "1.41.1"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/dismissable/-/dismissable-1.41.1.tgz#697a1f042f054654d704035581addf3ca77676f2"
|
||||
integrity sha512-nM3j3lz8XaYfW755N+Itp08BVFYhKhjlQ3EiBlc3LYwse4h2K5O3FwK87Ckqd/rBKrAb4eYFCkGNFSvjk0U/8g==
|
||||
dependencies:
|
||||
"@zag-js/dom-query" "1.40.0"
|
||||
"@zag-js/dom-query" "1.41.1"
|
||||
"@zag-js/interact-outside" "1.41.1"
|
||||
"@zag-js/utils" "1.41.1"
|
||||
|
||||
"@zag-js/dom-query@1.41.0":
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/dom-query/-/dom-query-1.41.0.tgz#5f434cf6cb6ccf524f479d4597c7b4f5ab3c561c"
|
||||
integrity sha512-10KVw1sZNKsiGcR9nC+xazn6r2hAijrJFcMJWWmtrXuskezV04/axCaWdEGHkPloddaoADecWwCAsD4+kOmKFg==
|
||||
dependencies:
|
||||
"@zag-js/types" "1.41.0"
|
||||
|
||||
"@zag-js/dom-query@1.41.1":
|
||||
version "1.41.1"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/dom-query/-/dom-query-1.41.1.tgz#e18b6b7f4b100e48d4c21643def02fb03fff7904"
|
||||
integrity sha512-f6hBV6fPc9Ok/Re/tsxqJ8NcgQzsASQ6YoulUKSQnZMGb7tr0Ks1IH3Hjy3+ARXvCaSjgDhPPXt5+bkieur4eg==
|
||||
dependencies:
|
||||
"@zag-js/types" "1.41.1"
|
||||
|
||||
"@zag-js/file-upload@^1.41.0":
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/file-upload/-/file-upload-1.41.0.tgz#6ad2deb4d5edc9db1c46fda6823be3a9d404b625"
|
||||
integrity sha512-zIAD1cx3zCa25G/nkHSH+VimU8YWAZYe+qYx+e/DSMUuebvkKRtBLXok4useKtxqLnn1rbX6GU7kLyC1ZSqgRQ==
|
||||
dependencies:
|
||||
"@zag-js/anatomy" "1.41.0"
|
||||
"@zag-js/core" "1.41.0"
|
||||
"@zag-js/dom-query" "1.41.0"
|
||||
"@zag-js/file-utils" "1.41.0"
|
||||
"@zag-js/i18n-utils" "1.41.0"
|
||||
"@zag-js/types" "1.41.0"
|
||||
"@zag-js/utils" "1.41.0"
|
||||
|
||||
"@zag-js/file-utils@1.41.0", "@zag-js/file-utils@^1.40.0":
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/file-utils/-/file-utils-1.41.0.tgz#1139d15b98db3463cead76bf7bf303428dac8f46"
|
||||
integrity sha512-ZNdMOFt6+pSB0dl4fbepWPDJX1KUqDxRTIDz78obzpdLdIrQazsRqdGDN3WG71ul6hYDXMuzphEj9HYyRENzaA==
|
||||
dependencies:
|
||||
"@zag-js/i18n-utils" "1.41.0"
|
||||
|
||||
"@zag-js/focus-trap@1.41.1":
|
||||
version "1.41.1"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/focus-trap/-/focus-trap-1.41.1.tgz#0ab2427d283da6ed7c04a770dc71a5e865eff534"
|
||||
integrity sha512-+KZpzvo4PQJI2M4GYRVgSEyD+X6Pu+paBS1zGlex0FLK+gzUVU0UnEtA1cSNS2oVMyHuu58mBZyYSCmeuMt5XA==
|
||||
dependencies:
|
||||
"@zag-js/dom-query" "1.41.1"
|
||||
|
||||
"@zag-js/i18n-utils@1.41.0":
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/i18n-utils/-/i18n-utils-1.41.0.tgz#da493ffac2482df38668a99d542d85a568516cc4"
|
||||
integrity sha512-+Ov6MJRSquHSFnUnCAWI/G5Xxaf0d64BsV+vzEFV0JPkLFT/2+ePzTwaVyYa+R55erHuMbpIxK/5PoxiLfEYkg==
|
||||
dependencies:
|
||||
"@zag-js/dom-query" "1.41.0"
|
||||
|
||||
"@zag-js/interact-outside@1.41.1":
|
||||
version "1.41.1"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/interact-outside/-/interact-outside-1.41.1.tgz#ea4caf67b4fa39e64dcd61374cc258ab1b9adf36"
|
||||
integrity sha512-N31jT0bBzCLBtAn31wVFxuxiOnXemNT+lKjK9j5HBZgrqgA/L3RdeV59aZ4Ar02Bb6F6DxU+MImzVvfgra1e6A==
|
||||
dependencies:
|
||||
"@zag-js/dom-query" "1.41.1"
|
||||
"@zag-js/utils" "1.41.1"
|
||||
|
||||
"@zag-js/password-input@^1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/password-input/-/password-input-1.40.0.tgz#8d70e938ad5646aef8869d967741a58608d0a16f"
|
||||
integrity sha512-mD4tbA4m82oV+0NbJ+P00Q4Gwz+zf1kZEZ3Z48ohICfK/WO1KhCgviY7vu/7bCMnRiD3dbi+nEeym8Kb29wRHw==
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/password-input/-/password-input-1.41.0.tgz#c55b8f15170bb5b7a86169623cc2277ec4788e96"
|
||||
integrity sha512-glJuzeUJxsBuXiJJ/RSr01mXKoxo6cvLcUbUrNdVGE1pnRMWdEJgVfItpmIZ+TrkUBzf88nru+MBuVeM0OKIAw==
|
||||
dependencies:
|
||||
"@zag-js/anatomy" "1.40.0"
|
||||
"@zag-js/core" "1.40.0"
|
||||
"@zag-js/dom-query" "1.40.0"
|
||||
"@zag-js/types" "1.40.0"
|
||||
"@zag-js/utils" "1.40.0"
|
||||
"@zag-js/anatomy" "1.41.0"
|
||||
"@zag-js/core" "1.41.0"
|
||||
"@zag-js/dom-query" "1.41.0"
|
||||
"@zag-js/types" "1.41.0"
|
||||
"@zag-js/utils" "1.41.0"
|
||||
|
||||
"@zag-js/store@1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/store/-/store-1.40.0.tgz#d27ed18e9bd8bf979315ab672d6481b71b482f1d"
|
||||
integrity sha512-EmgYIdbNZ4TN4Qht/jugY4UVkaWx69l8P1qiX23U4YwqNLq10tyOJmcXWbvsrprU1dGb24B+xq0WBm/RIjw4WA==
|
||||
"@zag-js/remove-scroll@1.41.1":
|
||||
version "1.41.1"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/remove-scroll/-/remove-scroll-1.41.1.tgz#9aac17b2526fafd1f31eee4c508d0f11de381fdd"
|
||||
integrity sha512-OihOx/EDghH4haEnwTsESMa9hUAOyau7hSgJBwu1cio/zozGJ5/umKRGGMe1v6Eh1len3B+iVEpMf65Rp2bSGg==
|
||||
dependencies:
|
||||
"@zag-js/dom-query" "1.41.1"
|
||||
|
||||
"@zag-js/store@1.41.0":
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/store/-/store-1.41.0.tgz#97a3ecc1bbb5fe8de51083e4dafaa0d0d3c2d741"
|
||||
integrity sha512-hnXqp1HrpP4pfn86NlI1i9yFo236sjhyMErIA2gxm/6L0FpcP3V/ooVSoQgKE9rTSurpDAmVqg6jBb+DxXzaIQ==
|
||||
dependencies:
|
||||
proxy-compare "3.0.1"
|
||||
|
||||
"@zag-js/toggle@^1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/toggle/-/toggle-1.40.0.tgz#8c2a757e51acca6ebd25385db8fb70217c51269b"
|
||||
integrity sha512-DW7682lzTP2eDlMvrS7tUX3zAm7ufrrKr7VDiX8BB6oXBRETXrVIxCYNuoIdqjwXebdjAoxaCiUZEreRVucYQg==
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/toggle/-/toggle-1.41.0.tgz#3245e651fc6f7ae2a2c4f86ae244ae90f3d3b517"
|
||||
integrity sha512-x5r12kTBKpAzMaKA9MQDEf1yo7bYByalw3BfRuEWfbclGfWehHKVjbyoM7iQxeUjwvWE0kbB/213AyS1/0eoOQ==
|
||||
dependencies:
|
||||
"@zag-js/anatomy" "1.40.0"
|
||||
"@zag-js/core" "1.40.0"
|
||||
"@zag-js/dom-query" "1.40.0"
|
||||
"@zag-js/types" "1.40.0"
|
||||
"@zag-js/utils" "1.40.0"
|
||||
"@zag-js/anatomy" "1.41.0"
|
||||
"@zag-js/core" "1.41.0"
|
||||
"@zag-js/dom-query" "1.41.0"
|
||||
"@zag-js/types" "1.41.0"
|
||||
"@zag-js/utils" "1.41.0"
|
||||
|
||||
"@zag-js/types@1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/types/-/types-1.40.0.tgz#6bd98a399d58724e6e81c11f4cbd0bb3501cc6fa"
|
||||
integrity sha512-LVvxEyqFv/u9SEe5xdivvG2vYb9cCmbkD+5r6s+IGljpDLaRgv4BYyxEh40ri1ai070tL08ZKmoLfx2/xfvY/A==
|
||||
"@zag-js/types@1.41.0":
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/types/-/types-1.41.0.tgz#6bfe6a776a753af2178e256b7c5d1066ebe368be"
|
||||
integrity sha512-CNTzGNjJU1e7VAzucjcjqBzpU7e1EBwRH29hCdyoigB4e4uDb+NrKUBHyAkfBVeNMLhpmXxnQfMDlvYt7K3W1A==
|
||||
dependencies:
|
||||
csstype "3.2.3"
|
||||
|
||||
"@zag-js/utils@1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/utils/-/utils-1.40.0.tgz#cf590c4b6ac294f74a369e8cda40ca7eec754400"
|
||||
integrity sha512-XUpqDtXfHe7CySjOhLPLj9H8rxbiFUJAGgmBzNdpsGPP4wx12cpOXrpSjRXZ2kMwooMPz/P7RPDBteto8sqhAQ==
|
||||
"@zag-js/types@1.41.1":
|
||||
version "1.41.1"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/types/-/types-1.41.1.tgz#46fb12a0fdf1ce20bdfe128ef66ece6216b677e4"
|
||||
integrity sha512-xhKEX61yvNa/6yofkNe7IihKyt3JLe4/k5JxaH0hj46V4S2Kac2cNAXPgnWHbl1gXGBcfLr+qLFzo4oLl+VdwA==
|
||||
dependencies:
|
||||
csstype "3.2.3"
|
||||
|
||||
"@zag-js/utils@1.41.0":
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/utils/-/utils-1.41.0.tgz#61639369aeadf26f91fe009b4ddce926c5ba607c"
|
||||
integrity sha512-WUCIw+W4MYKYfyKad0LLNNqhL58/cRAAAVjLqDch05c1dZ0yhZq3t81jWeYUwiPnprt9V+BtGJEFMnWhdfxsBA==
|
||||
|
||||
"@zag-js/utils@1.41.1":
|
||||
version "1.41.1"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/utils/-/utils-1.41.1.tgz#248fc28510d625034553fd9a4213147204fca323"
|
||||
integrity sha512-IZGqDpQYvgCQlGcLTVCzWG5DEz318ZLVJhp8TtT9HPDNd+RJTcVHRja7z+vqQ0Su+wKZkuLlIh5gtraxQ+YX9Q==
|
||||
|
||||
"@zag-js/vue@^1.40.0":
|
||||
version "1.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/vue/-/vue-1.40.0.tgz#f5d7f3ff68b6062ecab5611cc846fe39ddf08524"
|
||||
integrity sha512-sUkJfuESY42yNnSXszpkz4PCreW0rvEWir1s01zhow1rDi7WCNO1P7Jc9VrS5goVyzqsfInedUX2nzOO7XV5Iw==
|
||||
version "1.41.0"
|
||||
resolved "https://registry.yarnpkg.com/@zag-js/vue/-/vue-1.41.0.tgz#7e5649c1d5e7979493987de66d25d3deda90976e"
|
||||
integrity sha512-K3Fi7oMKpqUqm8lvL7RuWK3c9nyIlokxElEgrhh6MLEWbbmm6mXQ3BBGyWVjl58QWhHEluXvqrI8BVOg12Mpgg==
|
||||
dependencies:
|
||||
"@zag-js/core" "1.40.0"
|
||||
"@zag-js/store" "1.40.0"
|
||||
"@zag-js/types" "1.40.0"
|
||||
"@zag-js/utils" "1.40.0"
|
||||
"@zag-js/core" "1.41.0"
|
||||
"@zag-js/store" "1.41.0"
|
||||
"@zag-js/types" "1.41.0"
|
||||
"@zag-js/utils" "1.41.0"
|
||||
|
||||
acorn-jsx@^5.3.2:
|
||||
version "5.3.2"
|
||||
|
||||
2
server/.gitignore
vendored
2
server/.gitignore
vendored
@@ -18,3 +18,5 @@ node_modules
|
||||
|
||||
.env*
|
||||
*.db
|
||||
|
||||
uploads
|
||||
|
||||
@@ -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