Skip to content

Commit fec7dc3

Browse files
authored
Add typeshare support for GetInteractionKindPayload type (#761)
1 parent 18afaa5 commit fec7dc3

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

client/src/lib/api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import type { Notification } from '../lib/types';
44
import { InteractionKind } from '../lib/types';
55
import type { GetReviewsPayload } from '../lib/types';
66
import type { GetUserInteractionForCoursePayload } from '../lib/types';
7+
import type { GetInteractionKindPayload } from '../lib/types';
78
import type { GetInstructorPayload } from '../lib/types';
89
import type { GetCourseWithReviewsPayload } from '../model/get-course-with-reviews-payload';
910
import { GetCoursesPayload } from '../model/get-courses-payload';
10-
import type { GetInteractionsPayload } from '../model/get-interactions-payload';
1111
import type { SearchResults } from '../model/search-results';
1212

1313
const prefix = '/api';
@@ -166,8 +166,8 @@ export const api = {
166166
courseId: string,
167167
userId: string,
168168
referrer: string | undefined
169-
): Promise<GetInteractionsPayload> {
170-
return client.deserialize<GetInteractionsPayload>(
169+
): Promise<GetInteractionKindPayload> {
170+
return client.deserialize<GetInteractionKindPayload>(
171171
'GET',
172172
`/interactions?course_id=${courseId}&user_id=${userId}&referrer=${referrer}`
173173
);

client/src/lib/types.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,25 @@ export interface GetInstructorPayload {
3434
reviews: Review[];
3535
}
3636

37-
export interface GetReviewsPayload {
38-
/** List of reviews matching the query. */
39-
reviews: Review[];
40-
/** Number of unique users who have submitted reviews (if requested). */
41-
uniqueUserCount?: number;
42-
}
43-
4437
export enum InteractionKind {
4538
/** Indicates that the user liked the review. */
4639
Like = 'like',
4740
/** Indicates that the user disliked the review. */
4841
Dislike = 'dislike',
4942
}
5043

44+
export interface GetInteractionKindPayload {
45+
/** Interaction the user has taken for this course and referrer, if any. */
46+
kind?: InteractionKind;
47+
}
48+
49+
export interface GetReviewsPayload {
50+
/** List of reviews matching the query. */
51+
reviews: Review[];
52+
/** Number of unique users who have submitted reviews (if requested). */
53+
uniqueUserCount?: number;
54+
}
55+
5156
export interface Interaction {
5257
/** Kind of interaction that occurred. */
5358
kind: InteractionKind;

client/src/model/get-interactions-payload.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/interactions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub(crate) struct GetInteractionKindParams {
1111
}
1212

1313
#[derive(Debug, Deserialize, Serialize, PartialEq, ToSchema)]
14+
#[typeshare]
1415
pub(crate) struct GetInteractionKindPayload {
1516
/// Interaction the user has taken for this course and referrer, if any.
1617
pub(crate) kind: Option<InteractionKind>,

0 commit comments

Comments
 (0)