293 lines
7.1 KiB
TypeScript
293 lines
7.1 KiB
TypeScript
import { t } from "elysia";
|
|
|
|
import { __transformDate__ } from "./__transformDate__";
|
|
|
|
import { __nullable__ } from "./__nullable__";
|
|
|
|
export const UserPlain = t.Object(
|
|
{
|
|
id: t.String(),
|
|
email: t.String(),
|
|
username: t.String(),
|
|
password: t.String(),
|
|
createdAt: t.Date(),
|
|
},
|
|
{ additionalProperties: false },
|
|
);
|
|
|
|
export const UserRelations = t.Object(
|
|
{
|
|
messages: t.Array(
|
|
t.Object(
|
|
{
|
|
id: t.String(),
|
|
conversationId: t.String(),
|
|
senderId: t.String(),
|
|
content: t.String(),
|
|
createdAt: t.Date(),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
{ additionalProperties: false },
|
|
),
|
|
conversationMemberships: t.Array(
|
|
t.Object(
|
|
{
|
|
id: t.String(),
|
|
conversationId: t.String(),
|
|
userId: t.String(),
|
|
lastReadAt: __nullable__(t.Date()),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
{ additionalProperties: false },
|
|
),
|
|
},
|
|
{ additionalProperties: false },
|
|
);
|
|
|
|
export const UserPlainInputCreate = t.Object(
|
|
{ email: t.String(), username: t.String(), password: t.String() },
|
|
{ additionalProperties: false },
|
|
);
|
|
|
|
export const UserPlainInputUpdate = t.Object(
|
|
{
|
|
email: t.Optional(t.String()),
|
|
username: t.Optional(t.String()),
|
|
password: t.Optional(t.String()),
|
|
},
|
|
{ additionalProperties: false },
|
|
);
|
|
|
|
export const UserRelationsInputCreate = t.Object(
|
|
{
|
|
messages: t.Optional(
|
|
t.Object(
|
|
{
|
|
connect: t.Array(
|
|
t.Object(
|
|
{
|
|
id: t.String({ additionalProperties: false }),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
{ additionalProperties: false },
|
|
),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
),
|
|
conversationMemberships: t.Optional(
|
|
t.Object(
|
|
{
|
|
connect: t.Array(
|
|
t.Object(
|
|
{
|
|
id: t.String({ additionalProperties: false }),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
{ additionalProperties: false },
|
|
),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
),
|
|
},
|
|
{ additionalProperties: false },
|
|
);
|
|
|
|
export const UserRelationsInputUpdate = t.Partial(
|
|
t.Object(
|
|
{
|
|
messages: t.Partial(
|
|
t.Object(
|
|
{
|
|
connect: t.Array(
|
|
t.Object(
|
|
{
|
|
id: t.String({ additionalProperties: false }),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
{ additionalProperties: false },
|
|
),
|
|
disconnect: t.Array(
|
|
t.Object(
|
|
{
|
|
id: t.String({ additionalProperties: false }),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
{ additionalProperties: false },
|
|
),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
),
|
|
conversationMemberships: t.Partial(
|
|
t.Object(
|
|
{
|
|
connect: t.Array(
|
|
t.Object(
|
|
{
|
|
id: t.String({ additionalProperties: false }),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
{ additionalProperties: false },
|
|
),
|
|
disconnect: t.Array(
|
|
t.Object(
|
|
{
|
|
id: t.String({ additionalProperties: false }),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
{ additionalProperties: false },
|
|
),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
);
|
|
|
|
export const UserWhere = t.Partial(
|
|
t.Recursive(
|
|
(Self) =>
|
|
t.Object(
|
|
{
|
|
AND: t.Union([Self, t.Array(Self, { additionalProperties: false })]),
|
|
NOT: t.Union([Self, t.Array(Self, { additionalProperties: false })]),
|
|
OR: t.Array(Self, { additionalProperties: false }),
|
|
id: t.String(),
|
|
email: t.String(),
|
|
username: t.String(),
|
|
password: t.String(),
|
|
createdAt: t.Date(),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
{ $id: "User" },
|
|
),
|
|
);
|
|
|
|
export const UserWhereUnique = t.Recursive(
|
|
(Self) =>
|
|
t.Intersect(
|
|
[
|
|
t.Partial(
|
|
t.Object(
|
|
{ id: t.String(), email: t.String(), username: t.String() },
|
|
{ additionalProperties: false },
|
|
),
|
|
{ additionalProperties: false },
|
|
),
|
|
t.Union(
|
|
[
|
|
t.Object({ id: t.String() }),
|
|
t.Object({ email: t.String() }),
|
|
t.Object({ username: t.String() }),
|
|
],
|
|
{ additionalProperties: false },
|
|
),
|
|
t.Partial(
|
|
t.Object({
|
|
AND: t.Union([
|
|
Self,
|
|
t.Array(Self, { additionalProperties: false }),
|
|
]),
|
|
NOT: t.Union([
|
|
Self,
|
|
t.Array(Self, { additionalProperties: false }),
|
|
]),
|
|
OR: t.Array(Self, { additionalProperties: false }),
|
|
}),
|
|
{ additionalProperties: false },
|
|
),
|
|
t.Partial(
|
|
t.Object(
|
|
{
|
|
id: t.String(),
|
|
email: t.String(),
|
|
username: t.String(),
|
|
password: t.String(),
|
|
createdAt: t.Date(),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
),
|
|
],
|
|
{ additionalProperties: false },
|
|
),
|
|
{ $id: "User" },
|
|
);
|
|
|
|
export const UserSelect = t.Partial(
|
|
t.Object(
|
|
{
|
|
id: t.Boolean(),
|
|
email: t.Boolean(),
|
|
username: t.Boolean(),
|
|
password: t.Boolean(),
|
|
createdAt: t.Boolean(),
|
|
messages: t.Boolean(),
|
|
conversationMemberships: t.Boolean(),
|
|
_count: t.Boolean(),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
);
|
|
|
|
export const UserInclude = t.Partial(
|
|
t.Object(
|
|
{
|
|
messages: t.Boolean(),
|
|
conversationMemberships: t.Boolean(),
|
|
_count: t.Boolean(),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
);
|
|
|
|
export const UserOrderBy = t.Partial(
|
|
t.Object(
|
|
{
|
|
id: t.Union([t.Literal("asc"), t.Literal("desc")], {
|
|
additionalProperties: false,
|
|
}),
|
|
email: t.Union([t.Literal("asc"), t.Literal("desc")], {
|
|
additionalProperties: false,
|
|
}),
|
|
username: t.Union([t.Literal("asc"), t.Literal("desc")], {
|
|
additionalProperties: false,
|
|
}),
|
|
password: t.Union([t.Literal("asc"), t.Literal("desc")], {
|
|
additionalProperties: false,
|
|
}),
|
|
createdAt: t.Union([t.Literal("asc"), t.Literal("desc")], {
|
|
additionalProperties: false,
|
|
}),
|
|
},
|
|
{ additionalProperties: false },
|
|
),
|
|
);
|
|
|
|
export const User = t.Composite([UserPlain, UserRelations], {
|
|
additionalProperties: false,
|
|
});
|
|
|
|
export const UserInputCreate = t.Composite(
|
|
[UserPlainInputCreate, UserRelationsInputCreate],
|
|
{ additionalProperties: false },
|
|
);
|
|
|
|
export const UserInputUpdate = t.Composite(
|
|
[UserPlainInputUpdate, UserRelationsInputUpdate],
|
|
{ additionalProperties: false },
|
|
);
|