diff options
author | Puyodead1 <puyodead@proton.me> | 2023-03-25 16:09:04 -0400 |
---|---|---|
committer | Puyodead1 <puyodead@proton.me> | 2023-04-13 15:38:52 -0400 |
commit | 1ce7879ee85ea5bb5efaff3cf950e65513098d3c (patch) | |
tree | 825ae4c842b096736221668e59fc4c815998aec3 /src/util | |
parent | oapi: stickers (diff) | |
download | server-1ce7879ee85ea5bb5efaff3cf950e65513098d3c.tar.xz |
oapi: users progress
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/entities/User.ts | 3 | ||||
-rw-r--r-- | src/util/schemas/UserNoteUpdateSchema.ts | 3 | ||||
-rw-r--r-- | src/util/schemas/UserProfileResponse.ts | 4 | ||||
-rw-r--r-- | src/util/schemas/index.ts | 1 | ||||
-rw-r--r-- | src/util/schemas/responses/UserNoteResponse.ts | 5 | ||||
-rw-r--r-- | src/util/schemas/responses/UserProfileResponse.ts | 4 | ||||
-rw-r--r-- | src/util/schemas/responses/UserRelationshipsResponse.ts | 8 | ||||
-rw-r--r-- | src/util/schemas/responses/UserResponse.ts | 22 | ||||
-rw-r--r-- | src/util/schemas/responses/index.ts | 3 |
9 files changed, 47 insertions, 6 deletions
diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts index df9af328..85a5015b 100644 --- a/src/util/entities/User.ts +++ b/src/util/entities/User.ts @@ -86,8 +86,7 @@ export const PrivateUserProjection = [ // Private user data that should never get sent to the client export type PublicUser = Pick<User, PublicUserKeys>; - -export type UserPublic = Pick<User, PublicUserKeys>; +export type PrivateUser = Pick<User, PrivateUserKeys>; export interface UserPrivate extends Pick<User, PrivateUserKeys> { locale: string; diff --git a/src/util/schemas/UserNoteUpdateSchema.ts b/src/util/schemas/UserNoteUpdateSchema.ts new file mode 100644 index 00000000..0a731279 --- /dev/null +++ b/src/util/schemas/UserNoteUpdateSchema.ts @@ -0,0 +1,3 @@ +export interface UserNoteUpdateSchema { + note: string; +} diff --git a/src/util/schemas/UserProfileResponse.ts b/src/util/schemas/UserProfileResponse.ts index 699d6a29..4ef6431e 100644 --- a/src/util/schemas/UserProfileResponse.ts +++ b/src/util/schemas/UserProfileResponse.ts @@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { PublicConnectedAccount, UserPublic } from ".."; +import { PublicConnectedAccount, PublicUserResponse } from ".."; export interface UserProfileResponse { - user: UserPublic; + user: PublicUserResponse; connected_accounts: PublicConnectedAccount; premium_guild_since?: Date; premium_since?: Date; diff --git a/src/util/schemas/index.ts b/src/util/schemas/index.ts index 23d03190..44a504cd 100644 --- a/src/util/schemas/index.ts +++ b/src/util/schemas/index.ts @@ -69,6 +69,7 @@ export * from "./TotpSchema"; export * from "./UserDeleteSchema"; export * from "./UserGuildSettingsSchema"; export * from "./UserModifySchema"; +export * from "./UserNoteUpdateSchema"; export * from "./UserProfileModifySchema"; export * from "./UserSettingsSchema"; export * from "./Validator"; diff --git a/src/util/schemas/responses/UserNoteResponse.ts b/src/util/schemas/responses/UserNoteResponse.ts new file mode 100644 index 00000000..b142811e --- /dev/null +++ b/src/util/schemas/responses/UserNoteResponse.ts @@ -0,0 +1,5 @@ +export interface UserNoteResponse { + note: string; + note_user_id: string; + user_id: string; +} diff --git a/src/util/schemas/responses/UserProfileResponse.ts b/src/util/schemas/responses/UserProfileResponse.ts index 4e5cd8a6..bd1f46dd 100644 --- a/src/util/schemas/responses/UserProfileResponse.ts +++ b/src/util/schemas/responses/UserProfileResponse.ts @@ -1,7 +1,7 @@ -import { PublicConnectedAccount, UserPublic } from "../../entities"; +import { PublicConnectedAccount, PublicUser } from "../../entities"; export interface UserProfileResponse { - user: UserPublic; + user: PublicUser; connected_accounts: PublicConnectedAccount; premium_guild_since?: Date; premium_since?: Date; diff --git a/src/util/schemas/responses/UserRelationshipsResponse.ts b/src/util/schemas/responses/UserRelationshipsResponse.ts new file mode 100644 index 00000000..dff2f118 --- /dev/null +++ b/src/util/schemas/responses/UserRelationshipsResponse.ts @@ -0,0 +1,8 @@ +import { PublicUser, RelationshipType } from "../../entities"; + +export interface UserRelationshipsResponse { + id: string; + type: RelationshipType; + nickname: null; + user: PublicUser; +} diff --git a/src/util/schemas/responses/UserResponse.ts b/src/util/schemas/responses/UserResponse.ts new file mode 100644 index 00000000..21c30cd5 --- /dev/null +++ b/src/util/schemas/responses/UserResponse.ts @@ -0,0 +1,22 @@ +import { DmChannelDTO } from "../../dtos"; +import { Guild, PrivateUser, PublicUser, User } from "../../entities"; + +export type PublicUserResponse = PublicUser; +export type PrivateUserResponse = PrivateUser; + +export interface UserUpdateResponse extends PrivateUserResponse { + newToken?: string; +} + +export type UserGuildsResponse = Guild[]; + +export type UserChannelsResponse = DmChannelDTO[]; + +export interface UserBackupCodesResponse { + expired: unknown; + user: User; + code: string; + consumed: boolean; + id: string; +} +[]; diff --git a/src/util/schemas/responses/index.ts b/src/util/schemas/responses/index.ts index 3f29b779..1f0e2aed 100644 --- a/src/util/schemas/responses/index.ts +++ b/src/util/schemas/responses/index.ts @@ -39,6 +39,9 @@ export * from "./OAuthAuthorizeResponse"; export * from "./StickerPacksResponse"; export * from "./Tenor"; export * from "./TokenResponse"; +export * from "./UserNoteResponse"; export * from "./UserProfileResponse"; +export * from "./UserRelationshipsResponse"; export * from "./UserRelationsResponse"; +export * from "./UserResponse"; export * from "./WebhookCreateResponse"; |