brutalism design

This commit is contained in:
2026-05-22 05:08:02 +06:00
parent abf4d41c23
commit e4ed785911
51 changed files with 940 additions and 1171 deletions

1
new-client/AGENTS.md Normal file
View File

@@ -0,0 +1 @@
use context7

View File

@@ -6,10 +6,10 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vue-tsc -b && vite build", "build": "vue-tsc -b && vite build",
"preview": "vite preview" "preview": "vite preview",
"typegen": "npx swagger-typescript-api generate --path http://localhost:4000/reference/openapi.yaml --output ./src/shared/api --name generated-chad-api.ts"
}, },
"dependencies": { "dependencies": {
"@ark-ui/vue": "^5.36.2",
"@lucide/vue": "^1.14.0", "@lucide/vue": "^1.14.0",
"@tanstack/query-persist-client-core": "^5.100.10", "@tanstack/query-persist-client-core": "^5.100.10",
"@tanstack/vue-query": "^5.100.10", "@tanstack/vue-query": "^5.100.10",
@@ -20,9 +20,12 @@
"@vueuse/core": "^14.3.0", "@vueuse/core": "^14.3.0",
"@zag-js/avatar": "^1.40.0", "@zag-js/avatar": "^1.40.0",
"@zag-js/collapsible": "^1.40.0", "@zag-js/collapsible": "^1.40.0",
"@zag-js/file-utils": "^1.40.0",
"@zag-js/password-input": "^1.40.0", "@zag-js/password-input": "^1.40.0",
"@zag-js/toggle": "^1.40.0",
"@zag-js/vue": "^1.40.0", "@zag-js/vue": "^1.40.0",
"date-fns": "^4.1.0", "date-fns": "^4.1.0",
"mediasoup-client": "^3.20.0",
"mitt": "^3.0.1", "mitt": "^3.0.1",
"primevue": "^4.5.5", "primevue": "^4.5.5",
"socket.io-client": "^4.8.3", "socket.io-client": "^4.8.3",

View File

@@ -1,7 +1,9 @@
import initializeApp from './bootstrap/app' import initializeApp from './bootstrap/app'
import authorize from './bootstrap/authorize' import authorize from './bootstrap/authorize'
import showError from './bootstrap/error' import showError from './bootstrap/error'
import setupMediasoup from './bootstrap/mediasoup'
import preloader from './bootstrap/preloader' import preloader from './bootstrap/preloader'
import connectSignaling from './bootstrap/signaling'
import checkUpdates from './bootstrap/updater' import checkUpdates from './bootstrap/updater'
(async () => { (async () => {
@@ -13,6 +15,9 @@ import checkUpdates from './bootstrap/updater'
await authorize() await authorize()
connectSignaling()
setupMediasoup()
await initializeApp() await initializeApp()
} }
catch (error) { catch (error) {

View File

@@ -2,6 +2,7 @@ import { Api } from './generated-chad-api'
const api = new Api({ const api = new Api({
baseUrl: 'http://localhost:4000', baseUrl: 'http://localhost:4000',
baseApiParams: { credentials: 'include' },
}) })
function isChadResponseError(error) { function isChadResponseError(error) {

View File

@@ -30,7 +30,7 @@ export interface Attachment {
*/ */
export interface Channel { export interface Channel {
id: string; id: string;
ownerId: string | null; ownerUsername: string | null;
name: string; name: string;
persistent: boolean; persistent: boolean;
} }
@@ -42,15 +42,22 @@ export interface Channel {
export interface ChatMessage { export interface ChatMessage {
/** @format uuid */ /** @format uuid */
id: string; id: string;
/** @format uuid */ senderUsername: string;
senderId: string;
/** @minLength 1 */ /** @minLength 1 */
text: string; text: string;
/** @format date-time */ /** @format date-time */
createdAt: string; createdAt: string;
/** @format date-time */ /** @format date-time */
updatedAt: string; updatedAt: string;
attachments: string[]; attachments: {
id: string;
name: string;
mimetype: string;
/** @min 0 */
size: number;
/** @format date-time */
createdAt: string;
}[];
} }
/** /**
@@ -118,8 +125,7 @@ export interface NewChatMessagePayload {
export interface Reply { export interface Reply {
/** @format uuid */ /** @format uuid */
messageId: string; messageId: string;
/** @format uuid */ senderUsername: string;
senderId: string;
text: string; text: string;
} }
@@ -164,7 +170,6 @@ export interface UserPreferences {
* User * User
*/ */
export interface User { export interface User {
id: string;
username: string; username: string;
displayName: string; displayName: string;
/** @format date-time */ /** @format date-time */
@@ -232,7 +237,7 @@ export class HttpClient<SecurityDataType = unknown> {
fetch(...fetchParams); fetch(...fetchParams);
private baseApiParams: RequestParams = { private baseApiParams: RequestParams = {
credentials: "include", credentials: "same-origin",
headers: {}, headers: {},
redirect: "follow", redirect: "follow",
referrerPolicy: "no-referrer", referrerPolicy: "no-referrer",
@@ -590,30 +595,8 @@ export class Api<
* @summary Send message * @summary Send message
* @request POST:/chad/chat/send * @request POST:/chad/chat/send
*/ */
chatSend: ( chatSend: (data: NewChatMessagePayload, params: RequestParams = {}) =>
data: { this.request<ChatMessage, ResponseError>({
/** @minLength 1 */
text: string;
attachments?: string[];
},
params: RequestParams = {},
) =>
this.request<
{
/** @format uuid */
id: string;
/** @format uuid */
senderId: string;
/** @minLength 1 */
text: string;
/** @format date-time */
createdAt: string;
/** @format date-time */
updatedAt: string;
attachments: string[];
},
ResponseError
>({
path: `/chad/chat/send`, path: `/chad/chat/send`,
method: "POST", method: "POST",
body: data, body: data,
@@ -648,19 +631,7 @@ export class Api<
) => ) =>
this.request< this.request<
{ {
messages: { messages: ChatMessage[];
/** @format uuid */
id: string;
/** @format uuid */
senderId: string;
/** @minLength 1 */
text: string;
/** @format date-time */
createdAt: string;
/** @format date-time */
updatedAt: string;
attachments: string[];
}[];
/** /**
* Cursor to last message * Cursor to last message
* @format uuid * @format uuid

View File

@@ -8,7 +8,7 @@ export function qUser(username: MaybeRefOrGetter<string>) {
return useQuery<User, ResponseError>({ return useQuery<User, ResponseError>({
queryKey: ['user', username], queryKey: ['user', username],
queryFn: async () => { queryFn: async () => {
const response = await api.chad.userGet({ id: toValue(username) }) const response = await api.chad.userGet({ username: toValue(username) })
return response.data return response.data
}, },

View File

@@ -46,6 +46,10 @@ const api = computed(() => avatar.connect(service, normalizeProps))
#{$self}.highlighted & { #{$self}.highlighted & {
background-color: var(--yellow); background-color: var(--yellow);
} }
&[data-state='hidden'] {
display: none;
}
} }
&__image { &__image {
@@ -53,6 +57,10 @@ const api = computed(() => avatar.connect(service, normalizeProps))
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
object-position: center; object-position: center;
&[data-state='hidden'] {
display: none;
}
} }
} }
</style> </style>

View File

@@ -38,6 +38,7 @@ interface Props {
.chad-button { .chad-button {
@include font-display-14; @include font-display-14;
flex-shrink: 0;
border: none; border: none;
color: var(--ink); color: var(--ink);
padding-inline: var(--space-3); padding-inline: var(--space-3);

View File

@@ -0,0 +1,47 @@
<template>
<div class="chad-tag" :data-type="type">
<slot />
</div>
</template>
<script setup lang="ts">
interface Props {
type: 'success' | 'error'
}
defineOptions({
name: 'ChadTag',
})
defineProps<Props>()
</script>
<style lang="scss">
.chad-tag {
@include font-micro;
display: flex;
align-items: center;
gap: var(--space-1);
color: var(--grey-3);
&::before {
content: '';
display: block;
width: 10px;
height: 10px;
}
&[data-type='success'] {
&::before {
background-color: var(--green);
}
}
&[data-type='error'] {
&::before {
background-color: var(--red);
}
}
}
</style>

View File

@@ -0,0 +1,67 @@
<template>
<button class="chad-toggle" v-bind="api.getRootProps()">
<span class="chad-toggle__indicator" v-bind="api.getIndicatorProps()" />
<slot />
</button>
</template>
<script setup lang="ts">
import type { Component } from 'vue'
import * as toggle from '@zag-js/toggle'
import { normalizeProps, useMachine } from '@zag-js/vue'
import { computed } from 'vue'
defineOptions({
name: 'ChadToggle',
})
const props = defineProps<{
disabled?: boolean
icon?: Component
}>()
const modelValue = defineModel<boolean>('modelValue')
const service = useMachine(toggle.machine, computed(() => {
return {
disabled: props.disabled,
pressed: modelValue.value,
onPressedChange: (pressed) => {
modelValue.value = pressed
},
} as toggle.Props
}))
const api = computed(() => toggle.connect(service, normalizeProps))
</script>
<style lang="scss">
.chad-toggle {
@include font-micro;
border: var(--border-w) solid var(--ink);
height: 44px;
cursor: pointer;
&:hover,
&:active {
background-color: var(--grey-2);
}
&[data-state='on'] {
background-color: var(--yellow);
}
&[data-state='off'] {
background-color: var(--paper);
color: var(--grey-3);
}
&:disabled {
cursor: not-allowed;
background-color: var(--grey-1);
color: var(--grey-3);
}
}
</style>

View File

@@ -0,0 +1,72 @@
import type { ChadClient } from '@shared/types.ts'
import { useSignaling } from '@shared/composables/use-signaling.ts'
import { createGlobalState } from '@vueuse/core'
import { computed, shallowRef } from 'vue'
import { useAuth } from './use-auth'
export const useClients = createGlobalState(() => {
const { me } = useAuth()
const signaling = useSignaling()
const clients = shallowRef<ChadClient[]>([])
function addClient(...incoming: ChadClient[]) {
const ids = new Set(incoming.map(c => c.socketId))
clients.value = [
...clients.value.filter(c => !ids.has(c.socketId)),
...incoming,
]
}
function removeClient(...socketIds: string[]) {
const ids = new Set(socketIds)
clients.value = clients.value.filter(c => !ids.has(c.socketId))
}
function updateClient(socketId: string, patch: Partial<Omit<ChadClient, 'socketId'>>) {
clients.value = clients.value.map(c =>
c.socketId === socketId ? { ...c, ...patch } : c,
)
}
function findById(socketId: string) {
return clients.value.find(c => c.socketId === socketId)
}
function findByChannel(channelId: string) {
return clients.value.filter(c => c.channelId === channelId)
}
function findByUsername(username: string) {
return clients.value.find(c => c.username === username)
}
const self = computed(() => {
return clients.value.find((client) => {
if (signaling.socket.value) {
return client.socketId === signaling.socket.value.id
}
else if (me.value) {
return client.username === me.value.username
}
return undefined
})
})
function clear() {
clients.value = []
}
return {
clients,
self,
addClient,
removeClient,
updateClient,
findById,
findByChannel,
findByUsername,
clear,
}
})

View File

@@ -1,3 +1,4 @@
import type { ChatMessage } from '@shared/api/generated-chad-api.ts'
import type { EventType } from 'mitt' import type { EventType } from 'mitt'
import mitt from 'mitt' import mitt from 'mitt'
@@ -29,7 +30,7 @@ export interface AppEvents extends Record<EventType, unknown> {
'share:enabled': void 'share:enabled': void
'share:disabled': void 'share:disabled': void
'chat:new-message': void 'chat:new-message': ChatMessage
} }
const emitter = mitt<AppEvents>() const emitter = mitt<AppEvents>()

View File

@@ -0,0 +1,3 @@
export function useSession() {
return {}
}

View File

@@ -7,7 +7,7 @@ import { useAuth } from './use-auth'
import { useEventBus } from './use-event-bus' import { useEventBus } from './use-event-bus'
export const useSignaling = createSharedComposable(() => { export const useSignaling = createSharedComposable(() => {
const { emit } = useEventBus() const eventBus = useEventBus()
const { me } = useAuth() const { me } = useAuth()
const socket = shallowRef<Socket>() const socket = shallowRef<Socket>()
@@ -44,9 +44,9 @@ export const useSignaling = createSharedComposable(() => {
watch(connected, (connected) => { watch(connected, (connected) => {
if (connected) if (connected)
emit('socket:connected') eventBus.emit('socket:connected')
else else
emit('socket:disconnected') eventBus.emit('socket:disconnected')
}, { immediate: true }) }, { immediate: true })
watch(me, (me) => { watch(me, (me) => {
@@ -56,10 +56,7 @@ export const useSignaling = createSharedComposable(() => {
} }
}) })
onScopeDispose(() => { onScopeDispose(disconnect)
socket.value?.close()
socket.value = undefined
})
function connect() { function connect() {
if (socket.value || !me.value) if (socket.value || !me.value)
@@ -73,15 +70,18 @@ export const useSignaling = createSharedComposable(() => {
path: `${pathname}/ws`, path: `${pathname}/ws`,
transports: ['websocket'], transports: ['websocket'],
withCredentials: true, withCredentials: true,
auth: {
userId: me.value.id,
},
}) })
} }
function disconnect() {
socket.value?.disconnect()
socket.value = undefined
}
return { return {
socket, socket,
connected, connected,
connect, connect,
disconnect,
} }
}) })

View File

@@ -21,9 +21,22 @@
<aside class="sidebar"> <aside class="sidebar">
<ChannelList class="sidebar__channel-list" /> <ChannelList class="sidebar__channel-list" />
<ChadButton style="margin: var(--space-2);" @click="logout"> <!-- <dl> -->
Logout <!-- <template v-for="consumer in consumers.store.value.values()" :key="consumer.id"> -->
</ChadButton> <!-- <dt>{{ consumer.id }}</dt> -->
<!-- <dd><strong>paused</strong> <i>{{ consumer.paused }}</i></dd> -->
<!-- <dd><strong>appData</strong> <i>{{ consumer.appData }}</i></dd> -->
<!-- </template> -->
<!-- </dl> -->
<!-- <ChadButton style="margin: var(&#45;&#45;space-2);" @click="toggleMic"> -->
<!-- Toggle mic -->
<!-- </ChadButton> -->
<!-- <ChadButton style="margin: var(&#45;&#45;space-2);" @click="logout"> -->
<!-- Logout -->
<!-- </ChadButton> -->
<ControlPanel />
</aside> </aside>
<div class="content"> <div class="content">
@@ -33,17 +46,28 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import ChadButton from '@shared/components/ui/Button.vue'
import { useApp } from '@shared/composables/use-app.js' import { useApp } from '@shared/composables/use-app.js'
import { useAuth } from '@shared/composables/use-auth.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 ChannelList from '@widgets/channel-list/ui/ChannelList.vue'
import ControlPanel from '@widgets/control-panel/ui/ControlPanel.vue'
import { watchEffect } from 'vue'
defineOptions({ defineOptions({
name: 'DefaultLayout', name: 'DefaultLayout',
}) })
const { version } = useApp() const { version } = useApp()
const { logout } = useAuth()
const { sendTransport } = useMediasoup()
const { enableMic } = useProducers()
watchEffect(() => {
if (!sendTransport.value)
return
enableMic()
})
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@@ -35,9 +35,18 @@ a {
color: var(--yellow); color: var(--yellow);
} }
} }
//
//*, ::-webkit-scrollbar {
//*::before, color: var(--grey-2);
//*::after { height: 8px;
// @include font-body; width: 8px;
//} }
::-webkit-scrollbar-thumb {
background-color: var(--grey-2);
//border-right: 4px solid var(--paper);
&:hover {
background-color: var(--grey-3);
}
}

View File

@@ -1,7 +1,8 @@
export interface ChadClient { export interface ChadClient {
socketId: string socketId: string
userId: string username: string
channelId: string channelId: string
inputMuted?: boolean micMuted?: boolean
outputMuted?: boolean soundMuted?: boolean
streaming?: boolean
} }

View File

@@ -5,26 +5,38 @@
</div> </div>
<div v-bind="api.getContentProps()" class="channel__content"> <div v-bind="api.getContentProps()" class="channel__content">
Clients... <p v-for="client in clients" :key="client.socketId">
{{ client.username }}
</p>
</div> </div>
</li> </li>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { Channel } from '@shared/api/generated-chad-api.ts' import type { Channel } from '@shared/api/generated-chad-api.ts'
import type { ChadClient } from '@shared/types.ts' import { useClients } from '@shared/composables/use-clients.ts'
import * as collapsible from '@zag-js/collapsible' import * as collapsible from '@zag-js/collapsible'
import { normalizeProps, useMachine } from '@zag-js/vue' import { normalizeProps, useMachine } from '@zag-js/vue'
import { computed } from 'vue' import { computed } from 'vue'
const props = defineProps<{ const props = defineProps<{
channel: Channel channel: Channel
clients: ChadClient[]
}>() }>()
const service = useMachine(collapsible.machine, { id: '1' }) const { findByChannel } = useClients()
const service = useMachine(collapsible.machine, computed(() => {
return {
id: props.channel.id,
defaultOpen: true,
}
}))
const api = computed(() => collapsible.connect(service, normalizeProps)) const api = computed(() => collapsible.connect(service, normalizeProps))
const clients = computed(() => {
return findByChannel(props.channel.id)
})
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@@ -1,14 +1,14 @@
<template> <template>
<div class="channel-list"> <div class="channel-list">
<ul class="channel-list__list"> <ul class="channel-list__list">
<ChannelItem v-for="channel in channels" :key="channel.id" :channel="channel" /> <Channel v-for="channel in channels" :key="channel.id" :channel="channel" />
</ul> </ul>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { qChannelList } from '../api/qChannelList.ts' import { qChannelList } from '../api/qChannelList.ts'
import ChannelItem from './ChannelItem.vue' import Channel from './Channel.vue'
const { data: channels } = qChannelList() const { data: channels } = qChannelList()
</script> </script>

View File

@@ -1,5 +1,5 @@
import type { ChatMessage, ResponseError } from '@shared/api/generated-chad-api.ts' import type { ChatMessage, ResponseError } from '@shared/api/generated-chad-api.ts'
import type { InfiniteData, QueryKey } from '@tanstack/vue-query' import type { QueryKey } from '@tanstack/vue-query'
import api from '@shared/api/client.ts' import api from '@shared/api/client.ts'
import { useInfiniteQuery } from '@tanstack/vue-query' import { useInfiniteQuery } from '@tanstack/vue-query'
@@ -10,10 +10,10 @@ interface Response {
type PageParam = string | undefined type PageParam = string | undefined
export function qChatMessages() { export function qChatMessages() {
return useInfiniteQuery<Response, ResponseError, InfiniteData<Response, PageParam>, QueryKey, PageParam>({ return useInfiniteQuery<Response, ResponseError, ChatMessage[], QueryKey, PageParam>({
queryKey: ['chat-messages'], queryKey: ['chat-messages'],
queryFn: async ({ pageParam }) => { queryFn: async ({ pageParam }) => {
const response = await api.chad.chatMessages({ cursor: pageParam, limit: 30 }) const response = await api.chad.chatMessages({ cursor: pageParam, limit: 25 })
return response.data return response.data
// return { // return {
@@ -25,6 +25,9 @@ export function qChatMessages() {
// pages: [...data.pages].reverse(), // pages: [...data.pages].reverse(),
// pageParams: [...data.pageParams].reverse(), // pageParams: [...data.pageParams].reverse(),
// }), // }),
select: (data) => {
return data.pages.flatMap(page => page.messages).toReversed()
},
initialPageParam: undefined, initialPageParam: undefined,
getNextPageParam: (lastPage) => { getNextPageParam: (lastPage) => {
return lastPage.nextCursor return lastPage.nextCursor

View File

@@ -0,0 +1,79 @@
import type { MaybeRefOrGetter, TemplateRef } from 'vue'
import { useEventListener, useMutationObserver } from '@vueuse/core'
import { computed, reactive, toValue, watch } from 'vue'
interface ChatScrollOptions {
startOffset?: number
endOffset?: number
}
export function useChatScroll(target: TemplateRef<HTMLElement>, options?: MaybeRefOrGetter<ChatScrollOptions>) {
const el = computed(() => toValue(target))
const arrivedState = reactive({
start: true,
end: false,
})
watch(arrivedState, () => {
console.log('arrived state', arrivedState)
})
watch(el, (el) => {
if (!el)
return
scrollToStart(true)
getArrivedState()
}, { flush: 'post' })
useMutationObserver(el, () => {
if (arrivedState.start) {
scrollToStart(true)
}
getArrivedState()
}, {
childList: true,
// subtree: true,
})
useEventListener(el, 'scroll', () => {
getArrivedState()
}, { passive: true })
useEventListener(el, 'scrollend', () => {
getArrivedState()
}, { passive: true })
function getArrivedState() {
if (!el.value) {
arrivedState.start = true
arrivedState.end = false
return
}
const { startOffset = 0, endOffset = 0 } = toValue(options) ?? {}
const offsetHeight = el.value.offsetHeight
const scrollHeight = el.value.scrollHeight
const scrollTop = Math.abs(el.value.scrollTop)
arrivedState.start = scrollTop + offsetHeight >= scrollHeight - startOffset
arrivedState.end = scrollTop <= endOffset
}
function scrollToStart(instant = false) {
if (!el.value)
return
const offset = Math.ceil(el.value.scrollHeight - el.value.offsetHeight)
el.value.scrollTo({ top: offset, behavior: instant ? 'instant' : 'smooth' })
}
return {
arrivedState,
scrollToStart,
}
}

View File

@@ -1,13 +1,24 @@
import type { ChatMessage } from '@shared/api/generated-chad-api.ts'
import { useSignaling } from '@shared/composables/use-signaling'
import { createGlobalState } from '@vueuse/core' import { createGlobalState } from '@vueuse/core'
import { shallowRef, triggerRef, watch } from 'vue'
import { qChatMessages } from '../api/qChatMessages.ts' import { qChatMessages } from '../api/qChatMessages.ts'
export const useChat = createGlobalState(() => { export const useChat = createGlobalState(() => {
const { data: messages, hasNextPage: hasMoreMessages, fetchNextPage, isFetching } = qChatMessages() const { data: messages, hasNextPage: hasMoreMessages, fetchNextPage, isFetching } = qChatMessages()
return { const { socket, connected } = useSignaling()
messages, const feedItems = shallowRef<ChatMessage[]>([])
hasMoreMessages,
fetchNextPage, watch(connected, (isConnected) => {
isFetching, if (!isConnected)
} return
socket.value!.on('chat:new-message', (message: ChatMessage) => {
feedItems.value.push(message)
triggerRef(feedItems)
})
})
return { messages, feedItems, hasMoreMessages, fetchNextPage, isFetching }
}) })

View File

@@ -4,7 +4,7 @@
<div> <div>
<div class="chat-message__top"> <div class="chat-message__top">
<p class="chat-message__sender"> <p class="chat-message__sender">
{{ !sender ? message.senderId : sender.displayName }} {{ !sender ? message.senderUsername : sender.displayName }}
</p> </p>
<p class="chat-message__datetime"> <p class="chat-message__datetime">
@@ -16,9 +16,7 @@
{{ message.text }} {{ message.text }}
</p> </p>
<div v-if="message.attachments.length > 0" class="chat-message__attachments"> <ChatMessageAttachments v-if="message.attachments.length > 0" :attachments="message.attachments" class="chat-message__attachments" />
<ChatMessageAttachment v-for="attachmentId in message.attachments" :key="attachmentId" :attachment-id="attachmentId" />
</div>
</div> </div>
</div> </div>
</template> </template>
@@ -28,7 +26,7 @@ import type { ChatMessage } from '@shared/api/generated-chad-api.ts'
import ChadAvatar from '@shared/components/ui/Avatar.vue' import ChadAvatar from '@shared/components/ui/Avatar.vue'
import { useAuth } from '@shared/composables/use-auth.ts' import { useAuth } from '@shared/composables/use-auth.ts'
import { useUserDetails } from '@shared/composables/use-user-details.ts' import { useUserDetails } from '@shared/composables/use-user-details.ts'
import ChatMessageAttachment from '@widgets/chat/ui/ChatMessageAttachment.vue' import ChatMessageAttachments from '@widgets/chat/ui/ChatMessageAttachments.vue'
import { format, isThisYear, isToday } from 'date-fns' import { format, isThisYear, isToday } from 'date-fns'
import { computed, toRef } from 'vue' import { computed, toRef } from 'vue'
@@ -39,12 +37,12 @@ const props = defineProps<{
const { me } = useAuth() const { me } = useAuth()
const isMyMessage = computed(() => { const isMyMessage = computed(() => {
return props.message.senderId === me.value?.id return props.message.senderUsername === me.value?.username
}) })
const { user: sender, isFetching: fetchingSender } = useUserDetails(toRef(() => props.message.senderId)) const { user: sender } = useUserDetails(toRef(() => props.message.senderUsername))
const initials = computed(() => props.message.senderId.slice(props.message.senderId.length - 2)) const initials = computed(() => props.message.senderUsername.slice(props.message.senderUsername.length - 2))
const datetime = computed(() => { const datetime = computed(() => {
let formatStr = 'd MMMM yyyy, HH:mm' let formatStr = 'd MMMM yyyy, HH:mm'
@@ -68,7 +66,8 @@ const datetime = computed(() => {
grid-template-columns: auto 1fr; grid-template-columns: auto 1fr;
grid-template-areas: 'avatar top' 'avatar body'; grid-template-areas: 'avatar top' 'avatar body';
column-gap: var(--space-3); column-gap: var(--space-3);
padding: var(--space-3) var(--space-6); padding-block: var(--space-3);
padding-inline: var(--space-6);
&__avatar { &__avatar {
grid-area: avatar; grid-area: avatar;
@@ -99,11 +98,8 @@ const datetime = computed(() => {
} }
&__attachments { &__attachments {
//overflow-x: auto;
margin-top: var(--space-2); margin-top: var(--space-2);
> *:not(:last-child) {
margin-bottom: var(--space-1);
}
} }
} }
</style> </style>

View File

@@ -1,46 +1,91 @@
<template> <template>
<div class="chat-message-attachment"> <div class="chat-message-attachment" @click="download">
<p v-if="isFetching"> <div class="chat-message-attachment__extension">
Loading... {{ extension }}
</p> </div>
<template v-else-if="attachment"> <div class="chat-message-attachment__body">
<img v-if="isImage" :src="src" :alt="attachmentId" draggable="false"> <p class="chat-message-attachment__name">
</template> {{ attachment.name }}
</p>
<p class="chat-message-attachment__size">
{{ attachment.size }} KB
</p>
</div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { qMessageAttachment } from '@widgets/chat/api/qMessageAttachment.ts' import type { Attachment } from '@shared/api/generated-chad-api.ts'
import { computed, toRef } from 'vue' import api from '@shared/api/client.ts'
import { downloadFile } from '@zag-js/file-utils'
import { computed } from 'vue'
const props = defineProps<{ const props = defineProps<{
attachmentId: string attachment: Attachment
}>() }>()
const { isFetching, data: attachment } = qMessageAttachment(toRef(() => props.attachmentId)) const extension = computed(() => props.attachment.name.split('.')[1])
const isImage = computed(() => { const url = computed(() => {
return attachment.value?.type.startsWith('image/') return `${__API_BASE_URL__}/attachment/${props.attachment.id}`
}) })
const src = computed(() => { async function download() {
if (!attachment.value || !isImage.value) const response = await api.chad.attachmentGet(props.attachment.id, { format: 'blob' })
return undefined
return URL.createObjectURL(attachment.value) downloadFile({ name: props.attachment.name, type: props.attachment.mimetype, file: response.data })
}) }
</script> </script>
<style lang="scss"> <style lang="scss">
.chat-message-attachment { .chat-message-attachment {
display: grid;
grid-template-columns: 52px 1fr;
outline: var(--border-w) solid var(--ink); outline: var(--border-w) solid var(--ink);
outline-offset: calc(var(--border-w) * -1); outline-offset: calc(var(--border-w) * -1);
background-color: var(--grey-1); background-color: var(--grey-1);
width: fit-content; width: 300px;
height: 52px;
//overflow: hidden;
cursor: pointer;
> img { &:hover {
max-width: 260px; background-color: var(--grey-2);
max-height: 160px; }
&__extension {
@include font-label;
overflow: hidden;
white-space: nowrap;
line-height: 52px;
text-align: center;
background-color: var(--ink);
color: var(--white);
}
&__body {
flex: 1;
padding: var(--space-3);
align-self: center;
}
&__name {
@include font-body-bold;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&__size {
@include font-micro;
margin-top: var(--space-1);
color: var(--grey-3);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
} }
</style> </style>

View File

@@ -0,0 +1,51 @@
<template>
<div class="chat-message-attachments">
<div v-if="images.length > 0" class="chat-message-attachments__images">
<ChatMessageImageAttachment v-for="attachment in images" :key="attachment.id" :attachment="attachment" />
</div>
<div v-if="notImages.length > 0" class="chat-message-attachments__list">
<ChatMessageAttachment v-for="attachment in notImages" :key="attachment.id" :attachment="attachment" />
</div>
</div>
</template>
<script setup lang="ts">
import type { Attachment } from '@shared/api/generated-chad-api.ts'
import ChatMessageAttachment from '@widgets/chat/ui/ChatMessageAttachment.vue'
import ChatMessageImageAttachment from '@widgets/chat/ui/ChatMessageImageAttachment.vue'
import { computed } from 'vue'
const props = defineProps<{
attachments: Attachment[]
}>()
const images = computed(() => {
return props.attachments.filter(attachment => attachment.mimetype.startsWith('image/'))
})
const notImages = computed(() => {
return props.attachments.filter(attachment => !attachment.mimetype.startsWith('image/'))
})
</script>
<style lang="scss">
.chat-message-attachments {
> *:not(:last-child) {
margin-bottom: var(--space-3);
}
&__images {
display: flex;
gap: var(--space-2);
flex-wrap: nowrap;
overflow-x: auto;
}
&__list {
> *:not(:last-child) {
margin-bottom: var(--space-2);
}
}
}
</style>

View File

@@ -0,0 +1,33 @@
<template>
<div class="chat-message-image-attachment">
<img :src="src" :alt="attachment.name" draggable="false">
</div>
</template>
<script setup lang="ts">
import type { Attachment } from '@shared/api/generated-chad-api.ts'
import { computed } from 'vue'
const props = defineProps<{
attachment: Attachment
}>()
const src = computed(() => {
return `${__API_BASE_URL__}/attachment/${props.attachment.id}`
})
</script>
<style lang="scss">
.chat-message-image-attachment {
outline: var(--border-w) solid var(--ink);
outline-offset: calc(var(--border-w) * -1);
background-color: var(--grey-1);
width: fit-content;
height: 160px;
> img {
max-width: 260px;
height: 100%;
}
}
</style>

View File

@@ -1,38 +1,64 @@
<template> <template>
<div class="chat-messages"> <div class="chat-messages">
<div v-if="messages" ref="scroll" class="chat-messages__list"> <div v-if="messages" ref="scroll" class="chat-messages__list">
<template v-for="(page, pageIdx) in messages.pages" :key="pageIdx"> <ChatMessage v-for="message in messages" :key="message.id" :message="message" />
<ChatMessage v-for="message in page.messages" :key="message.id" :message="message" /> <ChatMessage v-for="item in feedItems" :key="item.id" :message="item" />
</template>
</div> </div>
<ChadSpinner v-if="isFetching" class="chat-messages__spinner" /> <ChadSpinner v-if="isFetching" class="chat-messages__spinner" />
<button v-if="!arrivedState.start" class="chat-messages__scroll-to-bottom" @click="scrollToStart()">
<ArrowDown />
</button>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ArrowDown } from '@lucide/vue'
import ChadSpinner from '@shared/components/ui/Spinner.vue' import ChadSpinner from '@shared/components/ui/Spinner.vue'
import { useInfiniteScroll } from '@vueuse/core' 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 ChatMessage from '@widgets/chat/ui/ChatMessage.vue'
import { useTemplateRef } from 'vue' import { onUnmounted, ref, useTemplateRef, watch } from 'vue'
import { useChat } from '../composables/use-chat' import { useChat } from '../composables/use-chat'
const eventBus = useEventBus()
const scrollRef = useTemplateRef('scroll') const scrollRef = useTemplateRef('scroll')
const { messages, hasMoreMessages, fetchNextPage, isFetching } = useChat() const { messages, feedItems, hasMoreMessages, fetchNextPage, isFetching } = useChat()
useInfiniteScroll( const hasUnreadMessages = ref(false)
scrollRef,
() => { const { arrivedState, scrollToStart } = useChatScroll(scrollRef, {
startOffset: 100,
endOffset: 100,
})
watch(() => arrivedState.end, (arrived) => {
if (!arrived)
return
if (hasMoreMessages.value) {
fetchNextPage() fetchNextPage()
}, }
{ })
distance: 500,
direction: 'top', watch(() => arrivedState.start, () => {
interval: 300, hasUnreadMessages.value = false
canLoadMore: () => hasMoreMessages.value && !isFetching.value, })
},
) eventBus.on('chat:new-message', onNewChatMessage)
onUnmounted(() => {
eventBus.off('chat:new-message', onNewChatMessage)
})
function onNewChatMessage() {
if (!arrivedState.start) {
hasUnreadMessages.value = true
}
}
</script> </script>
<style lang="scss"> <style lang="scss">
@@ -49,11 +75,34 @@ useInfiniteScroll(
} }
&__list { &__list {
overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
overflow-y: overlay;
display: flex; position: relative;
flex-direction: column-reverse; max-height: 100%;
height: 100%; }
&__scroll-to-bottom {
position: absolute;
cursor: pointer;
width: 40px;
aspect-ratio: 1;
text-align: center;
line-height: 40px;
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;
&:hover,
&:focus,
&:active {
background-color: var(--grey-2);
}
} }
} }
</style> </style>

View File

@@ -0,0 +1,63 @@
<template>
<div class="control-panel">
<ChadTag class="control-panel__status" :type="connected ? 'success' : 'error'">
{{ connected ? 'Connected' : 'Disconnected' }}
</ChadTag>
<div class="control-panel__toggles">
<ChadToggle :model-value="isMicEnabled" @update:model-value="toggleMic">
MIC
</ChadToggle>
<ChadToggle :model-value="isSoundEnabled" @update:model-value="toggleSound">
SND
</ChadToggle>
<ChadToggle :model-value="isCameraEnabled" @update:model-value="toggleCamera">
CAM
</ChadToggle>
<ChadToggle :model-value="isShareEnabled" @update:model-value="toggleShare">
SHR
</ChadToggle>
</div>
</div>
</template>
<script setup lang="ts">
import ChadTag from '@shared/components/ui/Tag.vue'
import ChadToggle from '@shared/components/ui/Toggle.vue'
import { useMediaControls } from '@shared/composables/use-media-controls.ts'
import { useSignaling } from '@shared/composables/use-signaling.ts'
const { connected } = useSignaling()
const {
isMicEnabled,
isSoundEnabled,
isCameraEnabled,
isShareEnabled,
toggleMic,
toggleSound,
toggleCamera,
toggleShare,
} = useMediaControls()
</script>
<style lang="scss">
.control-panel {
border-top: var(--border-w) solid var(--ink);
padding: var(--space-3);
background-color: var(--grey-1);
&__status {
margin-bottom: var(--space-3);
}
&__toggles {
display: grid;
grid-template-columns: repeat(4, 1fr);
align-items: center;
> *:not(:last-child) {
border-right: none;
}
}
}
</style>

View File

@@ -2,7 +2,7 @@
"extends": "@vue/tsconfig/tsconfig.dom.json", "extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": { "compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"lib": ["ES2023", "DOM"],
"moduleResolution": "Bundler", "moduleResolution": "Bundler",
"paths": { "paths": {
"@app/*": ["./src/app/*"], "@app/*": ["./src/app/*"],

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,6 @@ import fp from 'fastify-plugin'
import { Lucia } from 'lucia' import { Lucia } from 'lucia'
interface DatabaseUserAttributes { interface DatabaseUserAttributes {
id: string
displayName: string displayName: string
username: string username: string
createdAt: Date createdAt: Date

View File

@@ -1,7 +1,6 @@
import { Type } from 'typebox' import { Type } from 'typebox'
export const UserSchema = Type.Object({ export const UserSchema = Type.Object({
id: Type.String(),
username: Type.String(), username: Type.String(),
displayName: Type.String(), displayName: Type.String(),
createdAt: Type.String({ format: 'date-time' }), createdAt: Type.String({ format: 'date-time' }),

View File

@@ -2,7 +2,7 @@ import { Type } from 'typebox'
export const ChannelSchema = Type.Object({ export const ChannelSchema = Type.Object({
id: Type.String(), id: Type.String(),
ownerId: Type.Union([Type.String(), Type.Null()]), ownerUsername: Type.Union([Type.String(), Type.Null()]),
name: Type.String(), name: Type.String(),
persistent: Type.Boolean(), persistent: Type.Boolean(),
}, { $id: 'Channel' }) }, { $id: 'Channel' })

View File

@@ -1,19 +1,20 @@
import { Type } from 'typebox' import { Type } from 'typebox'
import { AttachmentSchema } from './attachment.ts'
export const ReplySchema = Type.Object({ export const ReplySchema = Type.Object({
messageId: Type.String({ format: 'uuid' }), messageId: Type.String({ format: 'uuid' }),
senderId: Type.String({ format: 'uuid' }), senderUsername: Type.String(),
text: Type.String(), text: Type.String(),
}, { $id: 'Reply' }) }, { $id: 'Reply' })
export const ChatMessageSchema = Type.Object({ export const ChatMessageSchema = Type.Object({
id: Type.String({ format: 'uuid' }), id: Type.String({ format: 'uuid' }),
senderId: Type.String({ format: 'uuid' }), senderUsername: Type.String(),
text: Type.String({ minLength: 1 }), text: Type.String({ minLength: 1 }),
createdAt: Type.String({ format: 'date-time' }), createdAt: Type.String({ format: 'date-time' }),
updatedAt: Type.String({ format: 'date-time' }), updatedAt: Type.String({ format: 'date-time' }),
attachments: Type.Array(Type.String({ format: 'uuid' })), attachments: Type.Array(AttachmentSchema),
}, { $id: 'ChatMessage' }) }, { $id: 'ChatMessage' })
export const NewChatMessagePayloadSchema = Type.Object({ export const NewChatMessagePayloadSchema = Type.Object({

View File

@@ -2,7 +2,6 @@ import { Type } from 'typebox'
export const GetUserQuerySchema = Type.Partial(Type.Object({ export const GetUserQuerySchema = Type.Partial(Type.Object({
username: Type.String(), username: Type.String(),
id: Type.String(),
}), { $id: 'GetUserQuery' }) }), { $id: 'GetUserQuery' })
export const UserPreferencesSchema = Type.Object({ export const UserPreferencesSchema = Type.Object({

View File

@@ -4,7 +4,7 @@ import type { Channel, User } from '../../prisma/generated-client/client.ts'
export interface SerializedClient { export interface SerializedClient {
socketId: string socketId: string
userId: User['id'] username: User['username']
channelId: Channel['id'] channelId: Channel['id']
inputMuted: boolean inputMuted: boolean
outputMuted: boolean outputMuted: boolean

View File

@@ -26,7 +26,7 @@ interface ClientEvents {
export class Client extends EventEmitter<ClientEvents> { export class Client extends EventEmitter<ClientEvents> {
readonly socketId: string readonly socketId: string
readonly userId: string readonly username: string
channelId: string = '' channelId: string = ''
#inputMuted = false #inputMuted = false
@@ -38,11 +38,11 @@ export class Client extends EventEmitter<ClientEvents> {
readonly #producers = new Map<string, types.Producer>() readonly #producers = new Map<string, types.Producer>()
readonly #consumers = new Map<string, types.Consumer>() readonly #consumers = new Map<string, types.Consumer>()
constructor(socketId: string, userId: string, router: types.Router) { constructor(socketId: string, username: string, router: types.Router) {
super() super()
this.socketId = socketId this.socketId = socketId
this.userId = userId this.username = username
this.#router = router this.#router = router
} }
@@ -278,7 +278,7 @@ export class Client extends EventEmitter<ClientEvents> {
serialize(): SerializedClient { serialize(): SerializedClient {
return { return {
socketId: this.socketId, socketId: this.socketId,
userId: this.userId, username: this.username,
channelId: this.channelId, channelId: this.channelId,
inputMuted: this.#inputMuted, inputMuted: this.#inputMuted,
outputMuted: this.#outputMuted, outputMuted: this.#outputMuted,

View File

@@ -23,7 +23,7 @@ export default async function (fastify: FastifyInstance) {
io.on('connection', async (socket) => { io.on('connection', async (socket) => {
consola.info('[WebRtc]', 'Client connected', socket.id) consola.info('[WebRtc]', 'Client connected', socket.id)
const client = new Client(socket.id, socket.data.user.id, mediasoupRouter) const client = new Client(socket.id, socket.data.user.username, mediasoupRouter)
defaultChannel.addClient(client) defaultChannel.addClient(client)
socket.join(defaultChannel.id) socket.join(defaultChannel.id)

View File

@@ -1,3 +1,4 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */ /* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */ /* eslint-disable */
// biome-ignore-all lint: generated file // biome-ignore-all lint: generated file
@@ -7,7 +8,7 @@
* Use it to get access to models, enums, and input types. * Use it to get access to models, enums, and input types.
* *
* This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only. * This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.
* See `Client.ts` for the standard, server-side entry point. * See `client.ts` for the standard, server-side entry point.
* *
* 🟢 You can import this file directly. * 🟢 You can import this file directly.
*/ */

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,4 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */ /* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */ /* eslint-disable */
// biome-ignore-all lint: generated file // biome-ignore-all lint: generated file
@@ -7,7 +8,7 @@
* *
* 🛑 Under no circumstances should you import this file directly! 🛑 * 🛑 Under no circumstances should you import this file directly! 🛑
* *
* All exports from this file are wrapped under a `Prisma` namespace object in the Client.ts file. * All exports from this file are wrapped under a `Prisma` namespace object in the client.ts file.
* While this enables partial backward compatibility, it is not part of the stable public API. * While this enables partial backward compatibility, it is not part of the stable public API.
* *
* If you are looking for your Models, Enums, and Input Types, please import them from the respective * If you are looking for your Models, Enums, and Input Types, please import them from the respective
@@ -964,7 +965,6 @@ export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof
export const UserScalarFieldEnum = { export const UserScalarFieldEnum = {
id: 'id',
username: 'username', username: 'username',
password: 'password', password: 'password',
displayName: 'displayName', displayName: 'displayName',
@@ -985,7 +985,7 @@ export type SessionScalarFieldEnum = (typeof SessionScalarFieldEnum)[keyof typeo
export const UserPreferencesScalarFieldEnum = { export const UserPreferencesScalarFieldEnum = {
userId: 'userId', username: 'username',
toggleInputHotkey: 'toggleInputHotkey', toggleInputHotkey: 'toggleInputHotkey',
toggleOutputHotkey: 'toggleOutputHotkey' toggleOutputHotkey: 'toggleOutputHotkey'
} as const } as const
@@ -1007,7 +1007,7 @@ export type AttachmentScalarFieldEnum = (typeof AttachmentScalarFieldEnum)[keyof
export const MessageScalarFieldEnum = { export const MessageScalarFieldEnum = {
id: 'id', id: 'id',
text: 'text', text: 'text',
senderId: 'senderId', senderUsername: 'senderUsername',
createdAt: 'createdAt', createdAt: 'createdAt',
updatedAt: 'updatedAt' updatedAt: 'updatedAt'
} as const } as const
@@ -1025,7 +1025,7 @@ export type MessageAttachmentScalarFieldEnum = (typeof MessageAttachmentScalarFi
export const ChannelScalarFieldEnum = { export const ChannelScalarFieldEnum = {
id: 'id', id: 'id',
ownerId: 'ownerId', ownerUsername: 'ownerUsername',
name: 'name', name: 'name',
persistent: 'persistent' persistent: 'persistent'
} as const } as const

View File

@@ -74,7 +74,6 @@ export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof
export const UserScalarFieldEnum = { export const UserScalarFieldEnum = {
id: 'id',
username: 'username', username: 'username',
password: 'password', password: 'password',
displayName: 'displayName', displayName: 'displayName',
@@ -95,7 +94,7 @@ export type SessionScalarFieldEnum = (typeof SessionScalarFieldEnum)[keyof typeo
export const UserPreferencesScalarFieldEnum = { export const UserPreferencesScalarFieldEnum = {
userId: 'userId', username: 'username',
toggleInputHotkey: 'toggleInputHotkey', toggleInputHotkey: 'toggleInputHotkey',
toggleOutputHotkey: 'toggleOutputHotkey' toggleOutputHotkey: 'toggleOutputHotkey'
} as const } as const
@@ -117,7 +116,7 @@ export type AttachmentScalarFieldEnum = (typeof AttachmentScalarFieldEnum)[keyof
export const MessageScalarFieldEnum = { export const MessageScalarFieldEnum = {
id: 'id', id: 'id',
text: 'text', text: 'text',
senderId: 'senderId', senderUsername: 'senderUsername',
createdAt: 'createdAt', createdAt: 'createdAt',
updatedAt: 'updatedAt' updatedAt: 'updatedAt'
} as const } as const
@@ -135,7 +134,7 @@ export type MessageAttachmentScalarFieldEnum = (typeof MessageAttachmentScalarFi
export const ChannelScalarFieldEnum = { export const ChannelScalarFieldEnum = {
id: 'id', id: 'id',
ownerId: 'ownerId', ownerUsername: 'ownerUsername',
name: 'name', name: 'name',
persistent: 'persistent' persistent: 'persistent'
} as const } as const

View File

@@ -26,21 +26,21 @@ export type AggregateChannel = {
export type ChannelMinAggregateOutputType = { export type ChannelMinAggregateOutputType = {
id: string | null id: string | null
ownerId: string | null ownerUsername: string | null
name: string | null name: string | null
persistent: boolean | null persistent: boolean | null
} }
export type ChannelMaxAggregateOutputType = { export type ChannelMaxAggregateOutputType = {
id: string | null id: string | null
ownerId: string | null ownerUsername: string | null
name: string | null name: string | null
persistent: boolean | null persistent: boolean | null
} }
export type ChannelCountAggregateOutputType = { export type ChannelCountAggregateOutputType = {
id: number id: number
ownerId: number ownerUsername: number
name: number name: number
persistent: number persistent: number
_all: number _all: number
@@ -49,21 +49,21 @@ export type ChannelCountAggregateOutputType = {
export type ChannelMinAggregateInputType = { export type ChannelMinAggregateInputType = {
id?: true id?: true
ownerId?: true ownerUsername?: true
name?: true name?: true
persistent?: true persistent?: true
} }
export type ChannelMaxAggregateInputType = { export type ChannelMaxAggregateInputType = {
id?: true id?: true
ownerId?: true ownerUsername?: true
name?: true name?: true
persistent?: true persistent?: true
} }
export type ChannelCountAggregateInputType = { export type ChannelCountAggregateInputType = {
id?: true id?: true
ownerId?: true ownerUsername?: true
name?: true name?: true
persistent?: true persistent?: true
_all?: true _all?: true
@@ -143,7 +143,7 @@ export type ChannelGroupByArgs<ExtArgs extends runtime.Types.Extensions.Internal
export type ChannelGroupByOutputType = { export type ChannelGroupByOutputType = {
id: string id: string
ownerId: string | null ownerUsername: string | null
name: string name: string
persistent: boolean persistent: boolean
_count: ChannelCountAggregateOutputType | null _count: ChannelCountAggregateOutputType | null
@@ -171,7 +171,7 @@ export type ChannelWhereInput = {
OR?: Prisma.ChannelWhereInput[] OR?: Prisma.ChannelWhereInput[]
NOT?: Prisma.ChannelWhereInput | Prisma.ChannelWhereInput[] NOT?: Prisma.ChannelWhereInput | Prisma.ChannelWhereInput[]
id?: Prisma.StringFilter<"Channel"> | string id?: Prisma.StringFilter<"Channel"> | string
ownerId?: Prisma.StringNullableFilter<"Channel"> | string | null ownerUsername?: Prisma.StringNullableFilter<"Channel"> | string | null
name?: Prisma.StringFilter<"Channel"> | string name?: Prisma.StringFilter<"Channel"> | string
persistent?: Prisma.BoolFilter<"Channel"> | boolean persistent?: Prisma.BoolFilter<"Channel"> | boolean
owner?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null owner?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
@@ -179,7 +179,7 @@ export type ChannelWhereInput = {
export type ChannelOrderByWithRelationInput = { export type ChannelOrderByWithRelationInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
ownerId?: Prisma.SortOrderInput | Prisma.SortOrder ownerUsername?: Prisma.SortOrderInput | Prisma.SortOrder
name?: Prisma.SortOrder name?: Prisma.SortOrder
persistent?: Prisma.SortOrder persistent?: Prisma.SortOrder
owner?: Prisma.UserOrderByWithRelationInput owner?: Prisma.UserOrderByWithRelationInput
@@ -190,7 +190,7 @@ export type ChannelWhereUniqueInput = Prisma.AtLeast<{
AND?: Prisma.ChannelWhereInput | Prisma.ChannelWhereInput[] AND?: Prisma.ChannelWhereInput | Prisma.ChannelWhereInput[]
OR?: Prisma.ChannelWhereInput[] OR?: Prisma.ChannelWhereInput[]
NOT?: Prisma.ChannelWhereInput | Prisma.ChannelWhereInput[] NOT?: Prisma.ChannelWhereInput | Prisma.ChannelWhereInput[]
ownerId?: Prisma.StringNullableFilter<"Channel"> | string | null ownerUsername?: Prisma.StringNullableFilter<"Channel"> | string | null
name?: Prisma.StringFilter<"Channel"> | string name?: Prisma.StringFilter<"Channel"> | string
persistent?: Prisma.BoolFilter<"Channel"> | boolean persistent?: Prisma.BoolFilter<"Channel"> | boolean
owner?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null owner?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
@@ -198,7 +198,7 @@ export type ChannelWhereUniqueInput = Prisma.AtLeast<{
export type ChannelOrderByWithAggregationInput = { export type ChannelOrderByWithAggregationInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
ownerId?: Prisma.SortOrderInput | Prisma.SortOrder ownerUsername?: Prisma.SortOrderInput | Prisma.SortOrder
name?: Prisma.SortOrder name?: Prisma.SortOrder
persistent?: Prisma.SortOrder persistent?: Prisma.SortOrder
_count?: Prisma.ChannelCountOrderByAggregateInput _count?: Prisma.ChannelCountOrderByAggregateInput
@@ -211,7 +211,7 @@ export type ChannelScalarWhereWithAggregatesInput = {
OR?: Prisma.ChannelScalarWhereWithAggregatesInput[] OR?: Prisma.ChannelScalarWhereWithAggregatesInput[]
NOT?: Prisma.ChannelScalarWhereWithAggregatesInput | Prisma.ChannelScalarWhereWithAggregatesInput[] NOT?: Prisma.ChannelScalarWhereWithAggregatesInput | Prisma.ChannelScalarWhereWithAggregatesInput[]
id?: Prisma.StringWithAggregatesFilter<"Channel"> | string id?: Prisma.StringWithAggregatesFilter<"Channel"> | string
ownerId?: Prisma.StringNullableWithAggregatesFilter<"Channel"> | string | null ownerUsername?: Prisma.StringNullableWithAggregatesFilter<"Channel"> | string | null
name?: Prisma.StringWithAggregatesFilter<"Channel"> | string name?: Prisma.StringWithAggregatesFilter<"Channel"> | string
persistent?: Prisma.BoolWithAggregatesFilter<"Channel"> | boolean persistent?: Prisma.BoolWithAggregatesFilter<"Channel"> | boolean
} }
@@ -225,7 +225,7 @@ export type ChannelCreateInput = {
export type ChannelUncheckedCreateInput = { export type ChannelUncheckedCreateInput = {
id?: string id?: string
ownerId?: string | null ownerUsername?: string | null
name: string name: string
persistent: boolean persistent: boolean
} }
@@ -239,14 +239,14 @@ export type ChannelUpdateInput = {
export type ChannelUncheckedUpdateInput = { export type ChannelUncheckedUpdateInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string id?: Prisma.StringFieldUpdateOperationsInput | string
ownerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null ownerUsername?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
name?: Prisma.StringFieldUpdateOperationsInput | string name?: Prisma.StringFieldUpdateOperationsInput | string
persistent?: Prisma.BoolFieldUpdateOperationsInput | boolean persistent?: Prisma.BoolFieldUpdateOperationsInput | boolean
} }
export type ChannelCreateManyInput = { export type ChannelCreateManyInput = {
id?: string id?: string
ownerId?: string | null ownerUsername?: string | null
name: string name: string
persistent: boolean persistent: boolean
} }
@@ -259,7 +259,7 @@ export type ChannelUpdateManyMutationInput = {
export type ChannelUncheckedUpdateManyInput = { export type ChannelUncheckedUpdateManyInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string id?: Prisma.StringFieldUpdateOperationsInput | string
ownerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null ownerUsername?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
name?: Prisma.StringFieldUpdateOperationsInput | string name?: Prisma.StringFieldUpdateOperationsInput | string
persistent?: Prisma.BoolFieldUpdateOperationsInput | boolean persistent?: Prisma.BoolFieldUpdateOperationsInput | boolean
} }
@@ -276,21 +276,21 @@ export type ChannelOrderByRelationAggregateInput = {
export type ChannelCountOrderByAggregateInput = { export type ChannelCountOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
ownerId?: Prisma.SortOrder ownerUsername?: Prisma.SortOrder
name?: Prisma.SortOrder name?: Prisma.SortOrder
persistent?: Prisma.SortOrder persistent?: Prisma.SortOrder
} }
export type ChannelMaxOrderByAggregateInput = { export type ChannelMaxOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
ownerId?: Prisma.SortOrder ownerUsername?: Prisma.SortOrder
name?: Prisma.SortOrder name?: Prisma.SortOrder
persistent?: Prisma.SortOrder persistent?: Prisma.SortOrder
} }
export type ChannelMinOrderByAggregateInput = { export type ChannelMinOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
ownerId?: Prisma.SortOrder ownerUsername?: Prisma.SortOrder
name?: Prisma.SortOrder name?: Prisma.SortOrder
persistent?: Prisma.SortOrder persistent?: Prisma.SortOrder
} }
@@ -383,7 +383,7 @@ export type ChannelScalarWhereInput = {
OR?: Prisma.ChannelScalarWhereInput[] OR?: Prisma.ChannelScalarWhereInput[]
NOT?: Prisma.ChannelScalarWhereInput | Prisma.ChannelScalarWhereInput[] NOT?: Prisma.ChannelScalarWhereInput | Prisma.ChannelScalarWhereInput[]
id?: Prisma.StringFilter<"Channel"> | string id?: Prisma.StringFilter<"Channel"> | string
ownerId?: Prisma.StringNullableFilter<"Channel"> | string | null ownerUsername?: Prisma.StringNullableFilter<"Channel"> | string | null
name?: Prisma.StringFilter<"Channel"> | string name?: Prisma.StringFilter<"Channel"> | string
persistent?: Prisma.BoolFilter<"Channel"> | boolean persistent?: Prisma.BoolFilter<"Channel"> | boolean
} }
@@ -416,7 +416,7 @@ export type ChannelUncheckedUpdateManyWithoutOwnerInput = {
export type ChannelSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type ChannelSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean id?: boolean
ownerId?: boolean ownerUsername?: boolean
name?: boolean name?: boolean
persistent?: boolean persistent?: boolean
owner?: boolean | Prisma.Channel$ownerArgs<ExtArgs> owner?: boolean | Prisma.Channel$ownerArgs<ExtArgs>
@@ -424,7 +424,7 @@ export type ChannelSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
export type ChannelSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type ChannelSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean id?: boolean
ownerId?: boolean ownerUsername?: boolean
name?: boolean name?: boolean
persistent?: boolean persistent?: boolean
owner?: boolean | Prisma.Channel$ownerArgs<ExtArgs> owner?: boolean | Prisma.Channel$ownerArgs<ExtArgs>
@@ -432,7 +432,7 @@ export type ChannelSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Exten
export type ChannelSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type ChannelSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean id?: boolean
ownerId?: boolean ownerUsername?: boolean
name?: boolean name?: boolean
persistent?: boolean persistent?: boolean
owner?: boolean | Prisma.Channel$ownerArgs<ExtArgs> owner?: boolean | Prisma.Channel$ownerArgs<ExtArgs>
@@ -440,12 +440,12 @@ export type ChannelSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Exten
export type ChannelSelectScalar = { export type ChannelSelectScalar = {
id?: boolean id?: boolean
ownerId?: boolean ownerUsername?: boolean
name?: boolean name?: boolean
persistent?: boolean persistent?: boolean
} }
export type ChannelOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "ownerId" | "name" | "persistent", ExtArgs["result"]["channel"]> export type ChannelOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "ownerUsername" | "name" | "persistent", ExtArgs["result"]["channel"]>
export type ChannelInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type ChannelInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
owner?: boolean | Prisma.Channel$ownerArgs<ExtArgs> owner?: boolean | Prisma.Channel$ownerArgs<ExtArgs>
} }
@@ -463,7 +463,7 @@ export type $ChannelPayload<ExtArgs extends runtime.Types.Extensions.InternalArg
} }
scalars: runtime.Types.Extensions.GetPayloadResult<{ scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string id: string
ownerId: string | null ownerUsername: string | null
name: string name: string
persistent: boolean persistent: boolean
}, ExtArgs["result"]["channel"]> }, ExtArgs["result"]["channel"]>
@@ -891,7 +891,7 @@ export interface Prisma__ChannelClient<T, Null = never, ExtArgs extends runtime.
*/ */
export interface ChannelFieldRefs { export interface ChannelFieldRefs {
readonly id: Prisma.FieldRef<"Channel", 'String'> readonly id: Prisma.FieldRef<"Channel", 'String'>
readonly ownerId: Prisma.FieldRef<"Channel", 'String'> readonly ownerUsername: Prisma.FieldRef<"Channel", 'String'>
readonly name: Prisma.FieldRef<"Channel", 'String'> readonly name: Prisma.FieldRef<"Channel", 'String'>
readonly persistent: Prisma.FieldRef<"Channel", 'Boolean'> readonly persistent: Prisma.FieldRef<"Channel", 'Boolean'>
} }

View File

@@ -27,7 +27,7 @@ export type AggregateMessage = {
export type MessageMinAggregateOutputType = { export type MessageMinAggregateOutputType = {
id: string | null id: string | null
text: string | null text: string | null
senderId: string | null senderUsername: string | null
createdAt: Date | null createdAt: Date | null
updatedAt: Date | null updatedAt: Date | null
} }
@@ -35,7 +35,7 @@ export type MessageMinAggregateOutputType = {
export type MessageMaxAggregateOutputType = { export type MessageMaxAggregateOutputType = {
id: string | null id: string | null
text: string | null text: string | null
senderId: string | null senderUsername: string | null
createdAt: Date | null createdAt: Date | null
updatedAt: Date | null updatedAt: Date | null
} }
@@ -43,7 +43,7 @@ export type MessageMaxAggregateOutputType = {
export type MessageCountAggregateOutputType = { export type MessageCountAggregateOutputType = {
id: number id: number
text: number text: number
senderId: number senderUsername: number
createdAt: number createdAt: number
updatedAt: number updatedAt: number
_all: number _all: number
@@ -53,7 +53,7 @@ export type MessageCountAggregateOutputType = {
export type MessageMinAggregateInputType = { export type MessageMinAggregateInputType = {
id?: true id?: true
text?: true text?: true
senderId?: true senderUsername?: true
createdAt?: true createdAt?: true
updatedAt?: true updatedAt?: true
} }
@@ -61,7 +61,7 @@ export type MessageMinAggregateInputType = {
export type MessageMaxAggregateInputType = { export type MessageMaxAggregateInputType = {
id?: true id?: true
text?: true text?: true
senderId?: true senderUsername?: true
createdAt?: true createdAt?: true
updatedAt?: true updatedAt?: true
} }
@@ -69,7 +69,7 @@ export type MessageMaxAggregateInputType = {
export type MessageCountAggregateInputType = { export type MessageCountAggregateInputType = {
id?: true id?: true
text?: true text?: true
senderId?: true senderUsername?: true
createdAt?: true createdAt?: true
updatedAt?: true updatedAt?: true
_all?: true _all?: true
@@ -150,7 +150,7 @@ export type MessageGroupByArgs<ExtArgs extends runtime.Types.Extensions.Internal
export type MessageGroupByOutputType = { export type MessageGroupByOutputType = {
id: string id: string
text: string text: string
senderId: string | null senderUsername: string | null
createdAt: Date createdAt: Date
updatedAt: Date updatedAt: Date
_count: MessageCountAggregateOutputType | null _count: MessageCountAggregateOutputType | null
@@ -179,7 +179,7 @@ export type MessageWhereInput = {
NOT?: Prisma.MessageWhereInput | Prisma.MessageWhereInput[] NOT?: Prisma.MessageWhereInput | Prisma.MessageWhereInput[]
id?: Prisma.StringFilter<"Message"> | string id?: Prisma.StringFilter<"Message"> | string
text?: Prisma.StringFilter<"Message"> | string text?: Prisma.StringFilter<"Message"> | string
senderId?: Prisma.StringNullableFilter<"Message"> | string | null senderUsername?: Prisma.StringNullableFilter<"Message"> | string | null
createdAt?: Prisma.DateTimeFilter<"Message"> | Date | string createdAt?: Prisma.DateTimeFilter<"Message"> | Date | string
updatedAt?: Prisma.DateTimeFilter<"Message"> | Date | string updatedAt?: Prisma.DateTimeFilter<"Message"> | Date | string
sender?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null sender?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
@@ -189,7 +189,7 @@ export type MessageWhereInput = {
export type MessageOrderByWithRelationInput = { export type MessageOrderByWithRelationInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
text?: Prisma.SortOrder text?: Prisma.SortOrder
senderId?: Prisma.SortOrderInput | Prisma.SortOrder senderUsername?: Prisma.SortOrderInput | Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
sender?: Prisma.UserOrderByWithRelationInput sender?: Prisma.UserOrderByWithRelationInput
@@ -202,7 +202,7 @@ export type MessageWhereUniqueInput = Prisma.AtLeast<{
OR?: Prisma.MessageWhereInput[] OR?: Prisma.MessageWhereInput[]
NOT?: Prisma.MessageWhereInput | Prisma.MessageWhereInput[] NOT?: Prisma.MessageWhereInput | Prisma.MessageWhereInput[]
text?: Prisma.StringFilter<"Message"> | string text?: Prisma.StringFilter<"Message"> | string
senderId?: Prisma.StringNullableFilter<"Message"> | string | null senderUsername?: Prisma.StringNullableFilter<"Message"> | string | null
createdAt?: Prisma.DateTimeFilter<"Message"> | Date | string createdAt?: Prisma.DateTimeFilter<"Message"> | Date | string
updatedAt?: Prisma.DateTimeFilter<"Message"> | Date | string updatedAt?: Prisma.DateTimeFilter<"Message"> | Date | string
sender?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null sender?: Prisma.XOR<Prisma.UserNullableScalarRelationFilter, Prisma.UserWhereInput> | null
@@ -212,7 +212,7 @@ export type MessageWhereUniqueInput = Prisma.AtLeast<{
export type MessageOrderByWithAggregationInput = { export type MessageOrderByWithAggregationInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
text?: Prisma.SortOrder text?: Prisma.SortOrder
senderId?: Prisma.SortOrderInput | Prisma.SortOrder senderUsername?: Prisma.SortOrderInput | Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
_count?: Prisma.MessageCountOrderByAggregateInput _count?: Prisma.MessageCountOrderByAggregateInput
@@ -226,7 +226,7 @@ export type MessageScalarWhereWithAggregatesInput = {
NOT?: Prisma.MessageScalarWhereWithAggregatesInput | Prisma.MessageScalarWhereWithAggregatesInput[] NOT?: Prisma.MessageScalarWhereWithAggregatesInput | Prisma.MessageScalarWhereWithAggregatesInput[]
id?: Prisma.StringWithAggregatesFilter<"Message"> | string id?: Prisma.StringWithAggregatesFilter<"Message"> | string
text?: Prisma.StringWithAggregatesFilter<"Message"> | string text?: Prisma.StringWithAggregatesFilter<"Message"> | string
senderId?: Prisma.StringNullableWithAggregatesFilter<"Message"> | string | null senderUsername?: Prisma.StringNullableWithAggregatesFilter<"Message"> | string | null
createdAt?: Prisma.DateTimeWithAggregatesFilter<"Message"> | Date | string createdAt?: Prisma.DateTimeWithAggregatesFilter<"Message"> | Date | string
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Message"> | Date | string updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Message"> | Date | string
} }
@@ -243,7 +243,7 @@ export type MessageCreateInput = {
export type MessageUncheckedCreateInput = { export type MessageUncheckedCreateInput = {
id?: string id?: string
text: string text: string
senderId?: string | null senderUsername?: string | null
createdAt?: Date | string createdAt?: Date | string
updatedAt?: Date | string updatedAt?: Date | string
attachments?: Prisma.MessageAttachmentUncheckedCreateNestedManyWithoutMessageInput attachments?: Prisma.MessageAttachmentUncheckedCreateNestedManyWithoutMessageInput
@@ -261,7 +261,7 @@ export type MessageUpdateInput = {
export type MessageUncheckedUpdateInput = { export type MessageUncheckedUpdateInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string id?: Prisma.StringFieldUpdateOperationsInput | string
text?: Prisma.StringFieldUpdateOperationsInput | string text?: Prisma.StringFieldUpdateOperationsInput | string
senderId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null senderUsername?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
attachments?: Prisma.MessageAttachmentUncheckedUpdateManyWithoutMessageNestedInput attachments?: Prisma.MessageAttachmentUncheckedUpdateManyWithoutMessageNestedInput
@@ -270,7 +270,7 @@ export type MessageUncheckedUpdateInput = {
export type MessageCreateManyInput = { export type MessageCreateManyInput = {
id?: string id?: string
text: string text: string
senderId?: string | null senderUsername?: string | null
createdAt?: Date | string createdAt?: Date | string
updatedAt?: Date | string updatedAt?: Date | string
} }
@@ -285,7 +285,7 @@ export type MessageUpdateManyMutationInput = {
export type MessageUncheckedUpdateManyInput = { export type MessageUncheckedUpdateManyInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string id?: Prisma.StringFieldUpdateOperationsInput | string
text?: Prisma.StringFieldUpdateOperationsInput | string text?: Prisma.StringFieldUpdateOperationsInput | string
senderId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null senderUsername?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
} }
@@ -303,7 +303,7 @@ export type MessageOrderByRelationAggregateInput = {
export type MessageCountOrderByAggregateInput = { export type MessageCountOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
text?: Prisma.SortOrder text?: Prisma.SortOrder
senderId?: Prisma.SortOrder senderUsername?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
} }
@@ -311,7 +311,7 @@ export type MessageCountOrderByAggregateInput = {
export type MessageMaxOrderByAggregateInput = { export type MessageMaxOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
text?: Prisma.SortOrder text?: Prisma.SortOrder
senderId?: Prisma.SortOrder senderUsername?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
} }
@@ -319,7 +319,7 @@ export type MessageMaxOrderByAggregateInput = {
export type MessageMinOrderByAggregateInput = { export type MessageMinOrderByAggregateInput = {
id?: Prisma.SortOrder id?: Prisma.SortOrder
text?: Prisma.SortOrder text?: Prisma.SortOrder
senderId?: Prisma.SortOrder senderUsername?: Prisma.SortOrder
createdAt?: Prisma.SortOrder createdAt?: Prisma.SortOrder
updatedAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder
} }
@@ -432,7 +432,7 @@ export type MessageScalarWhereInput = {
NOT?: Prisma.MessageScalarWhereInput | Prisma.MessageScalarWhereInput[] NOT?: Prisma.MessageScalarWhereInput | Prisma.MessageScalarWhereInput[]
id?: Prisma.StringFilter<"Message"> | string id?: Prisma.StringFilter<"Message"> | string
text?: Prisma.StringFilter<"Message"> | string text?: Prisma.StringFilter<"Message"> | string
senderId?: Prisma.StringNullableFilter<"Message"> | string | null senderUsername?: Prisma.StringNullableFilter<"Message"> | string | null
createdAt?: Prisma.DateTimeFilter<"Message"> | Date | string createdAt?: Prisma.DateTimeFilter<"Message"> | Date | string
updatedAt?: Prisma.DateTimeFilter<"Message"> | Date | string updatedAt?: Prisma.DateTimeFilter<"Message"> | Date | string
} }
@@ -448,7 +448,7 @@ export type MessageCreateWithoutAttachmentsInput = {
export type MessageUncheckedCreateWithoutAttachmentsInput = { export type MessageUncheckedCreateWithoutAttachmentsInput = {
id?: string id?: string
text: string text: string
senderId?: string | null senderUsername?: string | null
createdAt?: Date | string createdAt?: Date | string
updatedAt?: Date | string updatedAt?: Date | string
} }
@@ -480,7 +480,7 @@ export type MessageUpdateWithoutAttachmentsInput = {
export type MessageUncheckedUpdateWithoutAttachmentsInput = { export type MessageUncheckedUpdateWithoutAttachmentsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string id?: Prisma.StringFieldUpdateOperationsInput | string
text?: Prisma.StringFieldUpdateOperationsInput | string text?: Prisma.StringFieldUpdateOperationsInput | string
senderId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null senderUsername?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
} }
@@ -549,7 +549,7 @@ export type MessageCountOutputTypeCountAttachmentsArgs<ExtArgs extends runtime.T
export type MessageSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type MessageSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean id?: boolean
text?: boolean text?: boolean
senderId?: boolean senderUsername?: boolean
createdAt?: boolean createdAt?: boolean
updatedAt?: boolean updatedAt?: boolean
sender?: boolean | Prisma.Message$senderArgs<ExtArgs> sender?: boolean | Prisma.Message$senderArgs<ExtArgs>
@@ -560,7 +560,7 @@ export type MessageSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
export type MessageSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type MessageSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean id?: boolean
text?: boolean text?: boolean
senderId?: boolean senderUsername?: boolean
createdAt?: boolean createdAt?: boolean
updatedAt?: boolean updatedAt?: boolean
sender?: boolean | Prisma.Message$senderArgs<ExtArgs> sender?: boolean | Prisma.Message$senderArgs<ExtArgs>
@@ -569,7 +569,7 @@ export type MessageSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Exten
export type MessageSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type MessageSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean id?: boolean
text?: boolean text?: boolean
senderId?: boolean senderUsername?: boolean
createdAt?: boolean createdAt?: boolean
updatedAt?: boolean updatedAt?: boolean
sender?: boolean | Prisma.Message$senderArgs<ExtArgs> sender?: boolean | Prisma.Message$senderArgs<ExtArgs>
@@ -578,12 +578,12 @@ export type MessageSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Exten
export type MessageSelectScalar = { export type MessageSelectScalar = {
id?: boolean id?: boolean
text?: boolean text?: boolean
senderId?: boolean senderUsername?: boolean
createdAt?: boolean createdAt?: boolean
updatedAt?: boolean updatedAt?: boolean
} }
export type MessageOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "text" | "senderId" | "createdAt" | "updatedAt", ExtArgs["result"]["message"]> export type MessageOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "text" | "senderUsername" | "createdAt" | "updatedAt", ExtArgs["result"]["message"]>
export type MessageInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type MessageInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
sender?: boolean | Prisma.Message$senderArgs<ExtArgs> sender?: boolean | Prisma.Message$senderArgs<ExtArgs>
attachments?: boolean | Prisma.Message$attachmentsArgs<ExtArgs> attachments?: boolean | Prisma.Message$attachmentsArgs<ExtArgs>
@@ -605,7 +605,7 @@ export type $MessagePayload<ExtArgs extends runtime.Types.Extensions.InternalArg
scalars: runtime.Types.Extensions.GetPayloadResult<{ scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string id: string
text: string text: string
senderId: string | null senderUsername: string | null
createdAt: Date createdAt: Date
updatedAt: Date updatedAt: Date
}, ExtArgs["result"]["message"]> }, ExtArgs["result"]["message"]>
@@ -1035,7 +1035,7 @@ export interface Prisma__MessageClient<T, Null = never, ExtArgs extends runtime.
export interface MessageFieldRefs { export interface MessageFieldRefs {
readonly id: Prisma.FieldRef<"Message", 'String'> readonly id: Prisma.FieldRef<"Message", 'String'>
readonly text: Prisma.FieldRef<"Message", 'String'> readonly text: Prisma.FieldRef<"Message", 'String'>
readonly senderId: Prisma.FieldRef<"Message", 'String'> readonly senderUsername: Prisma.FieldRef<"Message", 'String'>
readonly createdAt: Prisma.FieldRef<"Message", 'DateTime'> readonly createdAt: Prisma.FieldRef<"Message", 'DateTime'>
readonly updatedAt: Prisma.FieldRef<"Message", 'DateTime'> readonly updatedAt: Prisma.FieldRef<"Message", 'DateTime'>
} }

View File

@@ -25,7 +25,6 @@ export type AggregateUser = {
} }
export type UserMinAggregateOutputType = { export type UserMinAggregateOutputType = {
id: string | null
username: string | null username: string | null
password: string | null password: string | null
displayName: string | null displayName: string | null
@@ -34,7 +33,6 @@ export type UserMinAggregateOutputType = {
} }
export type UserMaxAggregateOutputType = { export type UserMaxAggregateOutputType = {
id: string | null
username: string | null username: string | null
password: string | null password: string | null
displayName: string | null displayName: string | null
@@ -43,7 +41,6 @@ export type UserMaxAggregateOutputType = {
} }
export type UserCountAggregateOutputType = { export type UserCountAggregateOutputType = {
id: number
username: number username: number
password: number password: number
displayName: number displayName: number
@@ -54,7 +51,6 @@ export type UserCountAggregateOutputType = {
export type UserMinAggregateInputType = { export type UserMinAggregateInputType = {
id?: true
username?: true username?: true
password?: true password?: true
displayName?: true displayName?: true
@@ -63,7 +59,6 @@ export type UserMinAggregateInputType = {
} }
export type UserMaxAggregateInputType = { export type UserMaxAggregateInputType = {
id?: true
username?: true username?: true
password?: true password?: true
displayName?: true displayName?: true
@@ -72,7 +67,6 @@ export type UserMaxAggregateInputType = {
} }
export type UserCountAggregateInputType = { export type UserCountAggregateInputType = {
id?: true
username?: true username?: true
password?: true password?: true
displayName?: true displayName?: true
@@ -154,7 +148,6 @@ export type UserGroupByArgs<ExtArgs extends runtime.Types.Extensions.InternalArg
} }
export type UserGroupByOutputType = { export type UserGroupByOutputType = {
id: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -184,7 +177,6 @@ export type UserWhereInput = {
AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[] AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[]
OR?: Prisma.UserWhereInput[] OR?: Prisma.UserWhereInput[]
NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[] NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[]
id?: Prisma.StringFilter<"User"> | string
username?: Prisma.StringFilter<"User"> | string username?: Prisma.StringFilter<"User"> | string
password?: Prisma.StringFilter<"User"> | string password?: Prisma.StringFilter<"User"> | string
displayName?: Prisma.StringFilter<"User"> | string displayName?: Prisma.StringFilter<"User"> | string
@@ -197,7 +189,6 @@ export type UserWhereInput = {
} }
export type UserOrderByWithRelationInput = { export type UserOrderByWithRelationInput = {
id?: Prisma.SortOrder
username?: Prisma.SortOrder username?: Prisma.SortOrder
password?: Prisma.SortOrder password?: Prisma.SortOrder
displayName?: Prisma.SortOrder displayName?: Prisma.SortOrder
@@ -210,7 +201,6 @@ export type UserOrderByWithRelationInput = {
} }
export type UserWhereUniqueInput = Prisma.AtLeast<{ export type UserWhereUniqueInput = Prisma.AtLeast<{
id?: string
username?: string username?: string
AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[] AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[]
OR?: Prisma.UserWhereInput[] OR?: Prisma.UserWhereInput[]
@@ -223,10 +213,9 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{
UserPreferences?: Prisma.XOR<Prisma.UserPreferencesNullableScalarRelationFilter, Prisma.UserPreferencesWhereInput> | null UserPreferences?: Prisma.XOR<Prisma.UserPreferencesNullableScalarRelationFilter, Prisma.UserPreferencesWhereInput> | null
Messages?: Prisma.MessageListRelationFilter Messages?: Prisma.MessageListRelationFilter
Channels?: Prisma.ChannelListRelationFilter Channels?: Prisma.ChannelListRelationFilter
}, "id" | "username"> }, "username" | "username">
export type UserOrderByWithAggregationInput = { export type UserOrderByWithAggregationInput = {
id?: Prisma.SortOrder
username?: Prisma.SortOrder username?: Prisma.SortOrder
password?: Prisma.SortOrder password?: Prisma.SortOrder
displayName?: Prisma.SortOrder displayName?: Prisma.SortOrder
@@ -241,7 +230,6 @@ export type UserScalarWhereWithAggregatesInput = {
AND?: Prisma.UserScalarWhereWithAggregatesInput | Prisma.UserScalarWhereWithAggregatesInput[] AND?: Prisma.UserScalarWhereWithAggregatesInput | Prisma.UserScalarWhereWithAggregatesInput[]
OR?: Prisma.UserScalarWhereWithAggregatesInput[] OR?: Prisma.UserScalarWhereWithAggregatesInput[]
NOT?: Prisma.UserScalarWhereWithAggregatesInput | Prisma.UserScalarWhereWithAggregatesInput[] NOT?: Prisma.UserScalarWhereWithAggregatesInput | Prisma.UserScalarWhereWithAggregatesInput[]
id?: Prisma.StringWithAggregatesFilter<"User"> | string
username?: Prisma.StringWithAggregatesFilter<"User"> | string username?: Prisma.StringWithAggregatesFilter<"User"> | string
password?: Prisma.StringWithAggregatesFilter<"User"> | string password?: Prisma.StringWithAggregatesFilter<"User"> | string
displayName?: Prisma.StringWithAggregatesFilter<"User"> | string displayName?: Prisma.StringWithAggregatesFilter<"User"> | string
@@ -250,7 +238,6 @@ export type UserScalarWhereWithAggregatesInput = {
} }
export type UserCreateInput = { export type UserCreateInput = {
id?: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -263,7 +250,6 @@ export type UserCreateInput = {
} }
export type UserUncheckedCreateInput = { export type UserUncheckedCreateInput = {
id?: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -276,7 +262,6 @@ export type UserUncheckedCreateInput = {
} }
export type UserUpdateInput = { export type UserUpdateInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
username?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
displayName?: Prisma.StringFieldUpdateOperationsInput | string displayName?: Prisma.StringFieldUpdateOperationsInput | string
@@ -289,7 +274,6 @@ export type UserUpdateInput = {
} }
export type UserUncheckedUpdateInput = { export type UserUncheckedUpdateInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
username?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
displayName?: Prisma.StringFieldUpdateOperationsInput | string displayName?: Prisma.StringFieldUpdateOperationsInput | string
@@ -302,7 +286,6 @@ export type UserUncheckedUpdateInput = {
} }
export type UserCreateManyInput = { export type UserCreateManyInput = {
id?: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -311,7 +294,6 @@ export type UserCreateManyInput = {
} }
export type UserUpdateManyMutationInput = { export type UserUpdateManyMutationInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
username?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
displayName?: Prisma.StringFieldUpdateOperationsInput | string displayName?: Prisma.StringFieldUpdateOperationsInput | string
@@ -320,7 +302,6 @@ export type UserUpdateManyMutationInput = {
} }
export type UserUncheckedUpdateManyInput = { export type UserUncheckedUpdateManyInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
username?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
displayName?: Prisma.StringFieldUpdateOperationsInput | string displayName?: Prisma.StringFieldUpdateOperationsInput | string
@@ -329,7 +310,6 @@ export type UserUncheckedUpdateManyInput = {
} }
export type UserCountOrderByAggregateInput = { export type UserCountOrderByAggregateInput = {
id?: Prisma.SortOrder
username?: Prisma.SortOrder username?: Prisma.SortOrder
password?: Prisma.SortOrder password?: Prisma.SortOrder
displayName?: Prisma.SortOrder displayName?: Prisma.SortOrder
@@ -338,7 +318,6 @@ export type UserCountOrderByAggregateInput = {
} }
export type UserMaxOrderByAggregateInput = { export type UserMaxOrderByAggregateInput = {
id?: Prisma.SortOrder
username?: Prisma.SortOrder username?: Prisma.SortOrder
password?: Prisma.SortOrder password?: Prisma.SortOrder
displayName?: Prisma.SortOrder displayName?: Prisma.SortOrder
@@ -347,7 +326,6 @@ export type UserMaxOrderByAggregateInput = {
} }
export type UserMinOrderByAggregateInput = { export type UserMinOrderByAggregateInput = {
id?: Prisma.SortOrder
username?: Prisma.SortOrder username?: Prisma.SortOrder
password?: Prisma.SortOrder password?: Prisma.SortOrder
displayName?: Prisma.SortOrder displayName?: Prisma.SortOrder
@@ -434,7 +412,6 @@ export type UserUpdateOneWithoutChannelsNestedInput = {
} }
export type UserCreateWithoutSessionInput = { export type UserCreateWithoutSessionInput = {
id?: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -446,7 +423,6 @@ export type UserCreateWithoutSessionInput = {
} }
export type UserUncheckedCreateWithoutSessionInput = { export type UserUncheckedCreateWithoutSessionInput = {
id?: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -474,7 +450,6 @@ export type UserUpdateToOneWithWhereWithoutSessionInput = {
} }
export type UserUpdateWithoutSessionInput = { export type UserUpdateWithoutSessionInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
username?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
displayName?: Prisma.StringFieldUpdateOperationsInput | string displayName?: Prisma.StringFieldUpdateOperationsInput | string
@@ -486,7 +461,6 @@ export type UserUpdateWithoutSessionInput = {
} }
export type UserUncheckedUpdateWithoutSessionInput = { export type UserUncheckedUpdateWithoutSessionInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
username?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
displayName?: Prisma.StringFieldUpdateOperationsInput | string displayName?: Prisma.StringFieldUpdateOperationsInput | string
@@ -498,7 +472,6 @@ export type UserUncheckedUpdateWithoutSessionInput = {
} }
export type UserCreateWithoutUserPreferencesInput = { export type UserCreateWithoutUserPreferencesInput = {
id?: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -510,7 +483,6 @@ export type UserCreateWithoutUserPreferencesInput = {
} }
export type UserUncheckedCreateWithoutUserPreferencesInput = { export type UserUncheckedCreateWithoutUserPreferencesInput = {
id?: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -538,7 +510,6 @@ export type UserUpdateToOneWithWhereWithoutUserPreferencesInput = {
} }
export type UserUpdateWithoutUserPreferencesInput = { export type UserUpdateWithoutUserPreferencesInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
username?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
displayName?: Prisma.StringFieldUpdateOperationsInput | string displayName?: Prisma.StringFieldUpdateOperationsInput | string
@@ -550,7 +521,6 @@ export type UserUpdateWithoutUserPreferencesInput = {
} }
export type UserUncheckedUpdateWithoutUserPreferencesInput = { export type UserUncheckedUpdateWithoutUserPreferencesInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
username?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
displayName?: Prisma.StringFieldUpdateOperationsInput | string displayName?: Prisma.StringFieldUpdateOperationsInput | string
@@ -562,7 +532,6 @@ export type UserUncheckedUpdateWithoutUserPreferencesInput = {
} }
export type UserCreateWithoutMessagesInput = { export type UserCreateWithoutMessagesInput = {
id?: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -574,7 +543,6 @@ export type UserCreateWithoutMessagesInput = {
} }
export type UserUncheckedCreateWithoutMessagesInput = { export type UserUncheckedCreateWithoutMessagesInput = {
id?: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -602,7 +570,6 @@ export type UserUpdateToOneWithWhereWithoutMessagesInput = {
} }
export type UserUpdateWithoutMessagesInput = { export type UserUpdateWithoutMessagesInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
username?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
displayName?: Prisma.StringFieldUpdateOperationsInput | string displayName?: Prisma.StringFieldUpdateOperationsInput | string
@@ -614,7 +581,6 @@ export type UserUpdateWithoutMessagesInput = {
} }
export type UserUncheckedUpdateWithoutMessagesInput = { export type UserUncheckedUpdateWithoutMessagesInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
username?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
displayName?: Prisma.StringFieldUpdateOperationsInput | string displayName?: Prisma.StringFieldUpdateOperationsInput | string
@@ -626,7 +592,6 @@ export type UserUncheckedUpdateWithoutMessagesInput = {
} }
export type UserCreateWithoutChannelsInput = { export type UserCreateWithoutChannelsInput = {
id?: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -638,7 +603,6 @@ export type UserCreateWithoutChannelsInput = {
} }
export type UserUncheckedCreateWithoutChannelsInput = { export type UserUncheckedCreateWithoutChannelsInput = {
id?: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -666,7 +630,6 @@ export type UserUpdateToOneWithWhereWithoutChannelsInput = {
} }
export type UserUpdateWithoutChannelsInput = { export type UserUpdateWithoutChannelsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
username?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
displayName?: Prisma.StringFieldUpdateOperationsInput | string displayName?: Prisma.StringFieldUpdateOperationsInput | string
@@ -678,7 +641,6 @@ export type UserUpdateWithoutChannelsInput = {
} }
export type UserUncheckedUpdateWithoutChannelsInput = { export type UserUncheckedUpdateWithoutChannelsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
username?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
password?: Prisma.StringFieldUpdateOperationsInput | string password?: Prisma.StringFieldUpdateOperationsInput | string
displayName?: Prisma.StringFieldUpdateOperationsInput | string displayName?: Prisma.StringFieldUpdateOperationsInput | string
@@ -739,7 +701,6 @@ export type UserCountOutputTypeCountChannelsArgs<ExtArgs extends runtime.Types.E
export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
username?: boolean username?: boolean
password?: boolean password?: boolean
displayName?: boolean displayName?: boolean
@@ -753,7 +714,6 @@ export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
}, ExtArgs["result"]["user"]> }, ExtArgs["result"]["user"]>
export type UserSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type UserSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
username?: boolean username?: boolean
password?: boolean password?: boolean
displayName?: boolean displayName?: boolean
@@ -762,7 +722,6 @@ export type UserSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensio
}, ExtArgs["result"]["user"]> }, ExtArgs["result"]["user"]>
export type UserSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type UserSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
username?: boolean username?: boolean
password?: boolean password?: boolean
displayName?: boolean displayName?: boolean
@@ -771,7 +730,6 @@ export type UserSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensio
}, ExtArgs["result"]["user"]> }, ExtArgs["result"]["user"]>
export type UserSelectScalar = { export type UserSelectScalar = {
id?: boolean
username?: boolean username?: boolean
password?: boolean password?: boolean
displayName?: boolean displayName?: boolean
@@ -779,7 +737,7 @@ export type UserSelectScalar = {
updatedAt?: boolean updatedAt?: boolean
} }
export type UserOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "username" | "password" | "displayName" | "createdAt" | "updatedAt", ExtArgs["result"]["user"]> 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> = { export type UserInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
Session?: boolean | Prisma.User$SessionArgs<ExtArgs> Session?: boolean | Prisma.User$SessionArgs<ExtArgs>
UserPreferences?: boolean | Prisma.User$UserPreferencesArgs<ExtArgs> UserPreferences?: boolean | Prisma.User$UserPreferencesArgs<ExtArgs>
@@ -799,7 +757,6 @@ export type $UserPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
Channels: Prisma.$ChannelPayload<ExtArgs>[] Channels: Prisma.$ChannelPayload<ExtArgs>[]
} }
scalars: runtime.Types.Extensions.GetPayloadResult<{ scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
username: string username: string
password: string password: string
displayName: string displayName: string
@@ -888,8 +845,8 @@ export interface UserDelegate<ExtArgs extends runtime.Types.Extensions.InternalA
* // Get first 10 Users * // Get first 10 Users
* const users = await prisma.user.findMany({ take: 10 }) * const users = await prisma.user.findMany({ take: 10 })
* *
* // Only select the `id` * // Only select the `username`
* const userWithIdOnly = await prisma.user.findMany({ select: { id: true } }) * const userWithUsernameOnly = await prisma.user.findMany({ select: { username: true } })
* *
*/ */
findMany<T extends UserFindManyArgs>(args?: Prisma.SelectSubset<T, UserFindManyArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$UserPayload<ExtArgs>, T, "findMany", GlobalOmitOptions>> findMany<T extends UserFindManyArgs>(args?: Prisma.SelectSubset<T, UserFindManyArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$UserPayload<ExtArgs>, T, "findMany", GlobalOmitOptions>>
@@ -933,9 +890,9 @@ export interface UserDelegate<ExtArgs extends runtime.Types.Extensions.InternalA
* ] * ]
* }) * })
* *
* // Create many Users and only return the `id` * // Create many Users and only return the `username`
* const userWithIdOnly = await prisma.user.createManyAndReturn({ * const userWithUsernameOnly = await prisma.user.createManyAndReturn({
* select: { id: true }, * select: { username: true },
* data: [ * data: [
* // ... provide data here * // ... provide data here
* ] * ]
@@ -1024,9 +981,9 @@ export interface UserDelegate<ExtArgs extends runtime.Types.Extensions.InternalA
* ] * ]
* }) * })
* *
* // Update zero or more Users and only return the `id` * // Update zero or more Users and only return the `username`
* const userWithIdOnly = await prisma.user.updateManyAndReturn({ * const userWithUsernameOnly = await prisma.user.updateManyAndReturn({
* select: { id: true }, * select: { username: true },
* where: { * where: {
* // ... provide filter here * // ... provide filter here
* }, * },
@@ -1232,7 +1189,6 @@ export interface Prisma__UserClient<T, Null = never, ExtArgs extends runtime.Typ
* Fields of the User model * Fields of the User model
*/ */
export interface UserFieldRefs { export interface UserFieldRefs {
readonly id: Prisma.FieldRef<"User", 'String'>
readonly username: Prisma.FieldRef<"User", 'String'> readonly username: Prisma.FieldRef<"User", 'String'>
readonly password: Prisma.FieldRef<"User", 'String'> readonly password: Prisma.FieldRef<"User", 'String'>
readonly displayName: Prisma.FieldRef<"User", 'String'> readonly displayName: Prisma.FieldRef<"User", 'String'>

View File

@@ -25,19 +25,19 @@ export type AggregateUserPreferences = {
} }
export type UserPreferencesMinAggregateOutputType = { export type UserPreferencesMinAggregateOutputType = {
userId: string | null username: string | null
toggleInputHotkey: string | null toggleInputHotkey: string | null
toggleOutputHotkey: string | null toggleOutputHotkey: string | null
} }
export type UserPreferencesMaxAggregateOutputType = { export type UserPreferencesMaxAggregateOutputType = {
userId: string | null username: string | null
toggleInputHotkey: string | null toggleInputHotkey: string | null
toggleOutputHotkey: string | null toggleOutputHotkey: string | null
} }
export type UserPreferencesCountAggregateOutputType = { export type UserPreferencesCountAggregateOutputType = {
userId: number username: number
toggleInputHotkey: number toggleInputHotkey: number
toggleOutputHotkey: number toggleOutputHotkey: number
_all: number _all: number
@@ -45,19 +45,19 @@ export type UserPreferencesCountAggregateOutputType = {
export type UserPreferencesMinAggregateInputType = { export type UserPreferencesMinAggregateInputType = {
userId?: true username?: true
toggleInputHotkey?: true toggleInputHotkey?: true
toggleOutputHotkey?: true toggleOutputHotkey?: true
} }
export type UserPreferencesMaxAggregateInputType = { export type UserPreferencesMaxAggregateInputType = {
userId?: true username?: true
toggleInputHotkey?: true toggleInputHotkey?: true
toggleOutputHotkey?: true toggleOutputHotkey?: true
} }
export type UserPreferencesCountAggregateInputType = { export type UserPreferencesCountAggregateInputType = {
userId?: true username?: true
toggleInputHotkey?: true toggleInputHotkey?: true
toggleOutputHotkey?: true toggleOutputHotkey?: true
_all?: true _all?: true
@@ -136,7 +136,7 @@ export type UserPreferencesGroupByArgs<ExtArgs extends runtime.Types.Extensions.
} }
export type UserPreferencesGroupByOutputType = { export type UserPreferencesGroupByOutputType = {
userId: string username: string
toggleInputHotkey: string | null toggleInputHotkey: string | null
toggleOutputHotkey: string | null toggleOutputHotkey: string | null
_count: UserPreferencesCountAggregateOutputType | null _count: UserPreferencesCountAggregateOutputType | null
@@ -163,31 +163,31 @@ export type UserPreferencesWhereInput = {
AND?: Prisma.UserPreferencesWhereInput | Prisma.UserPreferencesWhereInput[] AND?: Prisma.UserPreferencesWhereInput | Prisma.UserPreferencesWhereInput[]
OR?: Prisma.UserPreferencesWhereInput[] OR?: Prisma.UserPreferencesWhereInput[]
NOT?: Prisma.UserPreferencesWhereInput | Prisma.UserPreferencesWhereInput[] NOT?: Prisma.UserPreferencesWhereInput | Prisma.UserPreferencesWhereInput[]
userId?: Prisma.StringFilter<"UserPreferences"> | string username?: Prisma.StringFilter<"UserPreferences"> | string
toggleInputHotkey?: Prisma.StringNullableFilter<"UserPreferences"> | string | null toggleInputHotkey?: Prisma.StringNullableFilter<"UserPreferences"> | string | null
toggleOutputHotkey?: Prisma.StringNullableFilter<"UserPreferences"> | string | null toggleOutputHotkey?: Prisma.StringNullableFilter<"UserPreferences"> | string | null
user?: Prisma.XOR<Prisma.UserScalarRelationFilter, Prisma.UserWhereInput> user?: Prisma.XOR<Prisma.UserScalarRelationFilter, Prisma.UserWhereInput>
} }
export type UserPreferencesOrderByWithRelationInput = { export type UserPreferencesOrderByWithRelationInput = {
userId?: Prisma.SortOrder username?: Prisma.SortOrder
toggleInputHotkey?: Prisma.SortOrderInput | Prisma.SortOrder toggleInputHotkey?: Prisma.SortOrderInput | Prisma.SortOrder
toggleOutputHotkey?: Prisma.SortOrderInput | Prisma.SortOrder toggleOutputHotkey?: Prisma.SortOrderInput | Prisma.SortOrder
user?: Prisma.UserOrderByWithRelationInput user?: Prisma.UserOrderByWithRelationInput
} }
export type UserPreferencesWhereUniqueInput = Prisma.AtLeast<{ export type UserPreferencesWhereUniqueInput = Prisma.AtLeast<{
userId?: string username?: string
AND?: Prisma.UserPreferencesWhereInput | Prisma.UserPreferencesWhereInput[] AND?: Prisma.UserPreferencesWhereInput | Prisma.UserPreferencesWhereInput[]
OR?: Prisma.UserPreferencesWhereInput[] OR?: Prisma.UserPreferencesWhereInput[]
NOT?: Prisma.UserPreferencesWhereInput | Prisma.UserPreferencesWhereInput[] NOT?: Prisma.UserPreferencesWhereInput | Prisma.UserPreferencesWhereInput[]
toggleInputHotkey?: Prisma.StringNullableFilter<"UserPreferences"> | string | null toggleInputHotkey?: Prisma.StringNullableFilter<"UserPreferences"> | string | null
toggleOutputHotkey?: Prisma.StringNullableFilter<"UserPreferences"> | string | null toggleOutputHotkey?: Prisma.StringNullableFilter<"UserPreferences"> | string | null
user?: Prisma.XOR<Prisma.UserScalarRelationFilter, Prisma.UserWhereInput> user?: Prisma.XOR<Prisma.UserScalarRelationFilter, Prisma.UserWhereInput>
}, "userId" | "userId"> }, "username" | "username">
export type UserPreferencesOrderByWithAggregationInput = { export type UserPreferencesOrderByWithAggregationInput = {
userId?: Prisma.SortOrder username?: Prisma.SortOrder
toggleInputHotkey?: Prisma.SortOrderInput | Prisma.SortOrder toggleInputHotkey?: Prisma.SortOrderInput | Prisma.SortOrder
toggleOutputHotkey?: Prisma.SortOrderInput | Prisma.SortOrder toggleOutputHotkey?: Prisma.SortOrderInput | Prisma.SortOrder
_count?: Prisma.UserPreferencesCountOrderByAggregateInput _count?: Prisma.UserPreferencesCountOrderByAggregateInput
@@ -199,7 +199,7 @@ export type UserPreferencesScalarWhereWithAggregatesInput = {
AND?: Prisma.UserPreferencesScalarWhereWithAggregatesInput | Prisma.UserPreferencesScalarWhereWithAggregatesInput[] AND?: Prisma.UserPreferencesScalarWhereWithAggregatesInput | Prisma.UserPreferencesScalarWhereWithAggregatesInput[]
OR?: Prisma.UserPreferencesScalarWhereWithAggregatesInput[] OR?: Prisma.UserPreferencesScalarWhereWithAggregatesInput[]
NOT?: Prisma.UserPreferencesScalarWhereWithAggregatesInput | Prisma.UserPreferencesScalarWhereWithAggregatesInput[] NOT?: Prisma.UserPreferencesScalarWhereWithAggregatesInput | Prisma.UserPreferencesScalarWhereWithAggregatesInput[]
userId?: Prisma.StringWithAggregatesFilter<"UserPreferences"> | string username?: Prisma.StringWithAggregatesFilter<"UserPreferences"> | string
toggleInputHotkey?: Prisma.StringNullableWithAggregatesFilter<"UserPreferences"> | string | null toggleInputHotkey?: Prisma.StringNullableWithAggregatesFilter<"UserPreferences"> | string | null
toggleOutputHotkey?: Prisma.StringNullableWithAggregatesFilter<"UserPreferences"> | string | null toggleOutputHotkey?: Prisma.StringNullableWithAggregatesFilter<"UserPreferences"> | string | null
} }
@@ -211,7 +211,7 @@ export type UserPreferencesCreateInput = {
} }
export type UserPreferencesUncheckedCreateInput = { export type UserPreferencesUncheckedCreateInput = {
userId: string username: string
toggleInputHotkey?: string | null toggleInputHotkey?: string | null
toggleOutputHotkey?: string | null toggleOutputHotkey?: string | null
} }
@@ -223,13 +223,13 @@ export type UserPreferencesUpdateInput = {
} }
export type UserPreferencesUncheckedUpdateInput = { export type UserPreferencesUncheckedUpdateInput = {
userId?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
toggleInputHotkey?: Prisma.NullableStringFieldUpdateOperationsInput | string | null toggleInputHotkey?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
toggleOutputHotkey?: Prisma.NullableStringFieldUpdateOperationsInput | string | null toggleOutputHotkey?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
} }
export type UserPreferencesCreateManyInput = { export type UserPreferencesCreateManyInput = {
userId: string username: string
toggleInputHotkey?: string | null toggleInputHotkey?: string | null
toggleOutputHotkey?: string | null toggleOutputHotkey?: string | null
} }
@@ -240,7 +240,7 @@ export type UserPreferencesUpdateManyMutationInput = {
} }
export type UserPreferencesUncheckedUpdateManyInput = { export type UserPreferencesUncheckedUpdateManyInput = {
userId?: Prisma.StringFieldUpdateOperationsInput | string username?: Prisma.StringFieldUpdateOperationsInput | string
toggleInputHotkey?: Prisma.NullableStringFieldUpdateOperationsInput | string | null toggleInputHotkey?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
toggleOutputHotkey?: Prisma.NullableStringFieldUpdateOperationsInput | string | null toggleOutputHotkey?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
} }
@@ -251,19 +251,19 @@ export type UserPreferencesNullableScalarRelationFilter = {
} }
export type UserPreferencesCountOrderByAggregateInput = { export type UserPreferencesCountOrderByAggregateInput = {
userId?: Prisma.SortOrder username?: Prisma.SortOrder
toggleInputHotkey?: Prisma.SortOrder toggleInputHotkey?: Prisma.SortOrder
toggleOutputHotkey?: Prisma.SortOrder toggleOutputHotkey?: Prisma.SortOrder
} }
export type UserPreferencesMaxOrderByAggregateInput = { export type UserPreferencesMaxOrderByAggregateInput = {
userId?: Prisma.SortOrder username?: Prisma.SortOrder
toggleInputHotkey?: Prisma.SortOrder toggleInputHotkey?: Prisma.SortOrder
toggleOutputHotkey?: Prisma.SortOrder toggleOutputHotkey?: Prisma.SortOrder
} }
export type UserPreferencesMinOrderByAggregateInput = { export type UserPreferencesMinOrderByAggregateInput = {
userId?: Prisma.SortOrder username?: Prisma.SortOrder
toggleInputHotkey?: Prisma.SortOrder toggleInputHotkey?: Prisma.SortOrder
toggleOutputHotkey?: Prisma.SortOrder toggleOutputHotkey?: Prisma.SortOrder
} }
@@ -343,33 +343,33 @@ export type UserPreferencesUncheckedUpdateWithoutUserInput = {
export type UserPreferencesSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type UserPreferencesSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
userId?: boolean username?: boolean
toggleInputHotkey?: boolean toggleInputHotkey?: boolean
toggleOutputHotkey?: boolean toggleOutputHotkey?: boolean
user?: boolean | Prisma.UserDefaultArgs<ExtArgs> user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
}, ExtArgs["result"]["userPreferences"]> }, ExtArgs["result"]["userPreferences"]>
export type UserPreferencesSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type UserPreferencesSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
userId?: boolean username?: boolean
toggleInputHotkey?: boolean toggleInputHotkey?: boolean
toggleOutputHotkey?: boolean toggleOutputHotkey?: boolean
user?: boolean | Prisma.UserDefaultArgs<ExtArgs> user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
}, ExtArgs["result"]["userPreferences"]> }, ExtArgs["result"]["userPreferences"]>
export type UserPreferencesSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{ export type UserPreferencesSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
userId?: boolean username?: boolean
toggleInputHotkey?: boolean toggleInputHotkey?: boolean
toggleOutputHotkey?: boolean toggleOutputHotkey?: boolean
user?: boolean | Prisma.UserDefaultArgs<ExtArgs> user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
}, ExtArgs["result"]["userPreferences"]> }, ExtArgs["result"]["userPreferences"]>
export type UserPreferencesSelectScalar = { export type UserPreferencesSelectScalar = {
userId?: boolean username?: boolean
toggleInputHotkey?: boolean toggleInputHotkey?: boolean
toggleOutputHotkey?: boolean toggleOutputHotkey?: boolean
} }
export type UserPreferencesOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"userId" | "toggleInputHotkey" | "toggleOutputHotkey", ExtArgs["result"]["userPreferences"]> export type UserPreferencesOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"username" | "toggleInputHotkey" | "toggleOutputHotkey", ExtArgs["result"]["userPreferences"]>
export type UserPreferencesInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type UserPreferencesInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
user?: boolean | Prisma.UserDefaultArgs<ExtArgs> user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
} }
@@ -386,7 +386,7 @@ export type $UserPreferencesPayload<ExtArgs extends runtime.Types.Extensions.Int
user: Prisma.$UserPayload<ExtArgs> user: Prisma.$UserPayload<ExtArgs>
} }
scalars: runtime.Types.Extensions.GetPayloadResult<{ scalars: runtime.Types.Extensions.GetPayloadResult<{
userId: string username: string
toggleInputHotkey: string | null toggleInputHotkey: string | null
toggleOutputHotkey: string | null toggleOutputHotkey: string | null
}, ExtArgs["result"]["userPreferences"]> }, ExtArgs["result"]["userPreferences"]>
@@ -472,8 +472,8 @@ export interface UserPreferencesDelegate<ExtArgs extends runtime.Types.Extension
* // Get first 10 UserPreferences * // Get first 10 UserPreferences
* const userPreferences = await prisma.userPreferences.findMany({ take: 10 }) * const userPreferences = await prisma.userPreferences.findMany({ take: 10 })
* *
* // Only select the `userId` * // Only select the `username`
* const userPreferencesWithUserIdOnly = await prisma.userPreferences.findMany({ select: { userId: true } }) * const userPreferencesWithUsernameOnly = await prisma.userPreferences.findMany({ select: { username: true } })
* *
*/ */
findMany<T extends UserPreferencesFindManyArgs>(args?: Prisma.SelectSubset<T, UserPreferencesFindManyArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$UserPreferencesPayload<ExtArgs>, T, "findMany", GlobalOmitOptions>> findMany<T extends UserPreferencesFindManyArgs>(args?: Prisma.SelectSubset<T, UserPreferencesFindManyArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$UserPreferencesPayload<ExtArgs>, T, "findMany", GlobalOmitOptions>>
@@ -517,9 +517,9 @@ export interface UserPreferencesDelegate<ExtArgs extends runtime.Types.Extension
* ] * ]
* }) * })
* *
* // Create many UserPreferences and only return the `userId` * // Create many UserPreferences and only return the `username`
* const userPreferencesWithUserIdOnly = await prisma.userPreferences.createManyAndReturn({ * const userPreferencesWithUsernameOnly = await prisma.userPreferences.createManyAndReturn({
* select: { userId: true }, * select: { username: true },
* data: [ * data: [
* // ... provide data here * // ... provide data here
* ] * ]
@@ -608,9 +608,9 @@ export interface UserPreferencesDelegate<ExtArgs extends runtime.Types.Extension
* ] * ]
* }) * })
* *
* // Update zero or more UserPreferences and only return the `userId` * // Update zero or more UserPreferences and only return the `username`
* const userPreferencesWithUserIdOnly = await prisma.userPreferences.updateManyAndReturn({ * const userPreferencesWithUsernameOnly = await prisma.userPreferences.updateManyAndReturn({
* select: { userId: true }, * select: { username: true },
* where: { * where: {
* // ... provide filter here * // ... provide filter here
* }, * },
@@ -813,7 +813,7 @@ export interface Prisma__UserPreferencesClient<T, Null = never, ExtArgs extends
* Fields of the UserPreferences model * Fields of the UserPreferences model
*/ */
export interface UserPreferencesFieldRefs { export interface UserPreferencesFieldRefs {
readonly userId: Prisma.FieldRef<"UserPreferences", 'String'> readonly username: Prisma.FieldRef<"UserPreferences", 'String'>
readonly toggleInputHotkey: Prisma.FieldRef<"UserPreferences", 'String'> readonly toggleInputHotkey: Prisma.FieldRef<"UserPreferences", 'String'>
readonly toggleOutputHotkey: Prisma.FieldRef<"UserPreferences", 'String'> readonly toggleOutputHotkey: Prisma.FieldRef<"UserPreferences", 'String'>
} }

View File

@@ -8,8 +8,7 @@ generator client {
} }
model User { model User {
id String @id @default(cuid()) username String @id @unique
username String @unique
password String password String
displayName String displayName String
createdAt DateTime @default(now()) createdAt DateTime @default(now())
@@ -26,17 +25,15 @@ model Session {
userId String userId String
expiresAt DateTime expiresAt DateTime
user User @relation(references: [id], fields: [userId], onDelete: Cascade) user User @relation(references: [username], fields: [userId], onDelete: Cascade)
@@index([userId])
} }
model UserPreferences { model UserPreferences {
userId String @id @unique username String @id @unique
toggleInputHotkey String? @default("") toggleInputHotkey String? @default("")
toggleOutputHotkey String? @default("") toggleOutputHotkey String? @default("")
user User @relation(references: [id], fields: [userId], onDelete: Cascade) user User @relation(references: [username], fields: [username], onDelete: Cascade)
} }
model Attachment { model Attachment {
@@ -52,11 +49,11 @@ model Attachment {
model Message { model Message {
id String @id @default(uuid()) id String @id @default(uuid())
text String text String
senderId String? senderUsername String?
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
sender User? @relation(references: [id], fields: [senderId], onDelete: SetNull) sender User? @relation(references: [username], fields: [senderUsername], onDelete: SetNull)
attachments MessageAttachment[] attachments MessageAttachment[]
} }
@@ -72,9 +69,9 @@ model MessageAttachment {
model Channel { model Channel {
id String @id @default(uuid()) id String @id @default(uuid())
ownerId String? ownerUsername String?
name String name String
persistent Boolean persistent Boolean
owner User? @relation(references: [id], fields: [ownerId], onDelete: Cascade) owner User? @relation(references: [username], fields: [ownerUsername], onDelete: Cascade)
} }

View File

@@ -33,13 +33,12 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
}, },
}) })
const session = await fastify.lucia.createSession(user.id, {}) const session = await fastify.lucia.createSession(user.username, {})
const cookie = fastify.lucia.createSessionCookie(session.id) const cookie = fastify.lucia.createSessionCookie(session.id)
reply.setCookie(cookie.name, cookie.value, cookie.attributes) reply.setCookie(cookie.name, cookie.value, cookie.attributes)
return { return {
id: user.id,
username: user.username, username: user.username,
displayName: user.username, displayName: user.username,
createdAt: user.createdAt.toISOString(), createdAt: user.createdAt.toISOString(),
@@ -67,7 +66,6 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
const user = await fastify.prisma.user.findFirst({ const user = await fastify.prisma.user.findFirst({
where: { username: req.body.username }, where: { username: req.body.username },
select: { select: {
id: true,
username: true, username: true,
displayName: true, displayName: true,
createdAt: true, createdAt: true,
@@ -84,7 +82,7 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
return reply.notFound('Incorrect username or password') return reply.notFound('Incorrect username or password')
} }
const session = await fastify.lucia.createSession(user.id, {}) const session = await fastify.lucia.createSession(user.username, {})
const cookie = fastify.lucia.createSessionCookie(session.id) const cookie = fastify.lucia.createSessionCookie(session.id)
reply.setCookie(cookie.name, cookie.value, cookie.attributes) reply.setCookie(cookie.name, cookie.value, cookie.attributes)
@@ -112,7 +110,6 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
const user = req.user! const user = req.user!
return { return {
id: user.id,
username: user.username, username: user.username,
displayName: user.displayName, displayName: user.displayName,
createdAt: user.createdAt.toISOString(), createdAt: user.createdAt.toISOString(),

View File

@@ -41,7 +41,7 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
const channel = await fastify.prisma.channel.create({ const channel = await fastify.prisma.channel.create({
data: { data: {
name: req.body.name, name: req.body.name,
ownerId: user.id, ownerUsername: user.username,
persistent: req.body.persistent, persistent: req.body.persistent,
}, },
}) })
@@ -73,7 +73,7 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
try { try {
const channel = await fastify.prisma.channel.delete({ const channel = await fastify.prisma.channel.delete({
where: { id: req.params.id, ownerId: user.id }, where: { id: req.params.id, ownerUsername: user.username },
}) })
fastify.bus.emit('channel:removed', channel) fastify.bus.emit('channel:removed', channel)

View File

@@ -1,6 +1,7 @@
import type { FastifyPluginAsyncTypebox } from '@fastify/type-provider-typebox' import type { FastifyPluginAsyncTypebox } from '@fastify/type-provider-typebox'
import { Type } from 'typebox' import { Type } from 'typebox'
import { ChatMessageSchema, NewChatMessagePayloadSchema } from '../plugins/schemas/chat.ts' import { ChatMessageSchema, NewChatMessagePayloadSchema } from '../plugins/schemas/chat.ts'
import { TypeboxRef } from '../utils/typebox-ref.ts'
const plugin: FastifyPluginAsyncTypebox = async (fastify) => { const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
fastify.post( fastify.post(
@@ -10,9 +11,9 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
summary: 'Send message', summary: 'Send message',
tags: ['Chat'], tags: ['Chat'],
operationId: 'chat.send', operationId: 'chat.send',
body: NewChatMessagePayloadSchema, body: TypeboxRef(NewChatMessagePayloadSchema),
response: { response: {
200: ChatMessageSchema, 200: TypeboxRef(ChatMessageSchema),
}, },
}, },
}, },
@@ -22,7 +23,7 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
const message = await fastify.prisma.message.create({ const message = await fastify.prisma.message.create({
data: { data: {
text: req.body.text, text: req.body.text,
senderId: user.id, senderUsername: user.username,
attachments: { attachments: {
create: (req.body.attachments ?? []).map((attachmentId) => { create: (req.body.attachments ?? []).map((attachmentId) => {
return { return {
@@ -35,6 +36,13 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
}), }),
}, },
}, },
include: {
attachments: {
include: {
attachment: true,
},
},
},
}) })
if (!message) { if (!message) {
@@ -43,11 +51,11 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
const response = { const response = {
id: message.id, id: message.id,
senderId: user.id, senderUsername: user.username,
text: message.text, text: message.text,
createdAt: message.createdAt.toISOString(), createdAt: message.createdAt.toISOString(),
updatedAt: message.updatedAt.toISOString(), updatedAt: message.updatedAt.toISOString(),
attachments: req.body.attachments ?? [], attachments: message.attachments.map(({ attachment }) => attachment),
} }
fastify.bus.emit('chat:new-message', response) fastify.bus.emit('chat:new-message', response)
@@ -69,7 +77,7 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
}), }),
response: { response: {
200: Type.Object({ 200: Type.Object({
messages: Type.Array(ChatMessageSchema), messages: Type.Array(TypeboxRef(ChatMessageSchema)),
nextCursor: Type.Optional(Type.String({ format: 'uuid', description: 'Cursor to last message' })), nextCursor: Type.Optional(Type.String({ format: 'uuid', description: 'Cursor to last message' })),
}), }),
}, },
@@ -81,7 +89,7 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
const messages = await fastify.prisma.message.findMany({ const messages = await fastify.prisma.message.findMany({
orderBy: { createdAt: 'desc' }, orderBy: { createdAt: 'desc' },
take: req.query.limit + 1, take: req.query.limit + 1,
include: { attachments: true }, include: { attachments: { include: { attachment: true } } },
...(req.query.cursor && { ...(req.query.cursor && {
cursor: { cursor: {
id: req.query.cursor, id: req.query.cursor,
@@ -99,7 +107,7 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
...message, ...message,
createdAt: message.createdAt.toISOString(), createdAt: message.createdAt.toISOString(),
updatedAt: message.updatedAt.toISOString(), updatedAt: message.updatedAt.toISOString(),
attachments: message.attachments.map(({ attachmentId }) => attachmentId), attachments: message.attachments.map(({ attachment }) => attachment),
} }
}), }),
nextCursor: cursorMessage?.id, nextCursor: cursorMessage?.id,

View File

@@ -19,9 +19,8 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
}, },
async (req, reply) => { async (req, reply) => {
const user = await fastify.prisma.user.findFirst({ const user = await fastify.prisma.user.findFirst({
where: { username: req.query.username, id: req.query.id }, where: { username: req.query.username },
select: { select: {
id: true,
username: true, username: true,
displayName: true, displayName: true,
createdAt: true, createdAt: true,
@@ -55,8 +54,8 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
const user = req.user! const user = req.user!
const preferences = await fastify.prisma.userPreferences.upsert({ const preferences = await fastify.prisma.userPreferences.upsert({
where: { userId: user.id }, where: { username: user.username },
create: { userId: user.id }, create: { username: user.username },
update: {}, update: {},
}) })
@@ -81,9 +80,9 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
const user = req.user! const user = req.user!
return fastify.prisma.userPreferences.upsert({ return fastify.prisma.userPreferences.upsert({
where: { userId: user.id }, where: { username: user.username },
create: { create: {
userId: user.id, username: user.username,
...req.body, ...req.body,
}, },
update: req.body, update: req.body,
@@ -108,12 +107,11 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
const user = req.user! const user = req.user!
const updatedUser = await fastify.prisma.user.update({ const updatedUser = await fastify.prisma.user.update({
where: { id: user.id }, where: { username: user.username },
data: { data: {
displayName: req.body.displayName, displayName: req.body.displayName,
}, },
select: { select: {
id: true,
username: true, username: true,
displayName: true, displayName: true,
createdAt: true, createdAt: true,