Skip to content

Commit

Permalink
feat: Post metadata and other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
juangm authored and cesarenaldi committed Dec 12, 2024
1 parent 1d1f797 commit acbea96
Show file tree
Hide file tree
Showing 19 changed files with 1,145 additions and 67 deletions.
8 changes: 4 additions & 4 deletions packages/graphql/src/accounts/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
AccountAvailableFragment,
AccountBlockedFragment,
AccountFragment,
PaginatedResultInfo,
PaginatedResultInfoFragment,
SelfFundedTransactionRequest,
SponsoredTransactionRequest,
TransactionWillFail,
Expand Down Expand Up @@ -33,7 +33,7 @@ export const SearchAccountsQuery = graphql(
}
}
}`,
[AccountFragment, PaginatedResultInfo],
[AccountFragment, PaginatedResultInfoFragment],
);

export type SearchAccountsRequest = RequestOf<typeof SearchAccountsQuery>;
Expand Down Expand Up @@ -210,7 +210,7 @@ export const AccountsAvailableQuery = graphql(
}
}
}`,
[AccountAvailableFragment, PaginatedResultInfo],
[AccountAvailableFragment, PaginatedResultInfoFragment],
);

export type AccountsAvailableRequest = RequestOf<typeof AccountsAvailableQuery>;
Expand All @@ -226,7 +226,7 @@ export const AccountsBlockedQuery = graphql(
}
}
}`,
[AccountBlockedFragment, PaginatedResultInfo],
[AccountBlockedFragment, PaginatedResultInfoFragment],
);

export type AccountsBlockedRequest = RequestOf<typeof AccountsBlockedQuery>;
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/src/accounts/managers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FragmentOf } from 'gql.tada';
import {
AccountManagerFragment,
PaginatedResultInfo,
PaginatedResultInfoFragment,
SelfFundedTransactionRequest,
SponsoredTransactionRequest,
TransactionWillFail,
Expand All @@ -19,7 +19,7 @@ export const AccountManagersQuery = graphql(
}
}
}`,
[AccountManagerFragment, PaginatedResultInfo],
[AccountManagerFragment, PaginatedResultInfoFragment],
);

export type AccountManagersRequest = RequestOf<typeof AccountManagersQuery>;
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FragmentOf } from 'gql.tada';
import {
App,
AppFragment,
SelfFundedTransactionRequest,
SponsoredTransactionRequest,
TransactionWillFail,
Expand All @@ -13,7 +13,7 @@ export const AppQuery = graphql(
...App
}
}`,
[App],
[AppFragment],
);
export type AppRequest = RequestOf<typeof AppQuery>;

Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/src/authentication.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FragmentOf } from 'gql.tada';
import { PaginatedResultInfo } from './fragments';
import { PaginatedResultInfoFragment } from './fragments';
import { type RequestOf, graphql } from './graphql';

const AuthenticationChallenge = graphql(
Expand Down Expand Up @@ -124,7 +124,7 @@ export const AuthenticatedSessionsQuery = graphql(
}
}
}`,
[AuthenticatedSession, PaginatedResultInfo],
[AuthenticatedSession, PaginatedResultInfoFragment],
);
export type AuthenticatedSessionsRequest = RequestOf<typeof AuthenticatedSessionsQuery>;

Expand Down
9 changes: 9 additions & 0 deletions packages/graphql/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,12 @@ export enum PostReactionType {
Upvote = 'UPVOTE',
Downvote = 'DOWNVOTE',
}

/**
* Enum for the different content warnings.
*/
export enum ContentWarning {
nsfw = 'NSFW',
sensitive = 'SENSITIVE',
spoiler = 'SPOILER',
}
8 changes: 4 additions & 4 deletions packages/graphql/src/follow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { FragmentOf } from 'gql.tada';
import {
AccountFragment,
BooleanValue,
PaginatedResultInfo,
PaginatedResultInfoFragment,
SelfFundedTransactionRequest,
SponsoredTransactionRequest,
TransactionWillFail,
Expand Down Expand Up @@ -125,7 +125,7 @@ export const FollowersQuery = graphql(
}
}
}`,
[Follower, PaginatedResultInfo],
[Follower, PaginatedResultInfoFragment],
);
export type FollowersRequest = RequestOf<typeof FollowersQuery>;

Expand All @@ -141,7 +141,7 @@ export const FollowingQuery = graphql(
}
}
}`,
[Following, PaginatedResultInfo],
[Following, PaginatedResultInfoFragment],
);
export type FollowingRequest = RequestOf<typeof FollowingQuery>;

Expand All @@ -157,7 +157,7 @@ export const FollowersYouKnowQuery = graphql(
}
}
}`,
[Follower, PaginatedResultInfo],
[Follower, PaginatedResultInfoFragment],
);
export type FollowersYouKnowRequest = RequestOf<typeof FollowersYouKnowQuery>;

Expand Down
2 changes: 2 additions & 0 deletions packages/graphql/src/fragments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ export * from './SelfFundedTransactionRequest';
export * from './TransactionWillFail';
export * from './username';
export * from './namespace';
export * from './media';
export * from './metadata';
61 changes: 61 additions & 0 deletions packages/graphql/src/fragments/media.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import type { FragmentOf } from 'gql.tada';
import { graphql } from '../graphql';

export const MediaAudioFragment = graphql(
`fragment MediaAudio on MediaAudio {
__typename
artist
cover
credits
duration
genre
item
kind
license
lyrics
recordLabel
type
}`,
);
export type MediaAudio = FragmentOf<typeof MediaAudioFragment>;

export const MediaImageFragment = graphql(
`fragment MediaImage on MediaImage {
__typename
altTag
item
license
type
}`,
);
export type MediaImage = FragmentOf<typeof MediaImageFragment>;

export const MediaVideoFragment = graphql(
`fragment MediaVideo on MediaVideo {
__typename
altTag
cover
duration
item
license
type
}`,
);
export type MediaVideo = FragmentOf<typeof MediaVideoFragment>;

export const AnyMediaFragment = graphql(
`fragment AnyMedia on AnyMedia {
... on MediaAudio {
...MediaAudio
}
... on MediaImage {
...MediaImage
}
... on MediaVideo {
...MediaVideo
}
}
`,
[MediaAudioFragment, MediaImageFragment, MediaVideoFragment],
);
export type AnyMedia = FragmentOf<typeof AnyMediaFragment>;
Loading

0 comments on commit acbea96

Please sign in to comment.