Skip to content

Commit b894d93

Browse files
authored
Revert OpenAPI to latest release and fix app initialization (#99)
* Ignore the fetch feed request's slug ID anchor if it is invalid * Initialize data feed upon launch * Revert openapi to use latest stable
1 parent 0fbc37e commit b894d93

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ all: dev
22

33
generate:
44
docker run --rm \
5-
-v ${PWD}:/local openapitools/openapi-generator-cli:latest generate \
5+
-v ${PWD}:/local openapitools/openapi-generator-cli:latest-release generate \
66
-i /local/services/api/openapi-zkorum.json \
77
-g typescript-axios \
88
-o /local/services/agora/src/api
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.10.0-SNAPSHOT
1+
7.7.0

services/agora/src/api/api.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -1352,23 +1352,23 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
13521352
* @param {*} [options] Override http request option.
13531353
* @throws {RequiredError}
13541354
*/
1355-
apiV1AuthAuthenticatePost(apiV1AuthAuthenticatePostRequest: ApiV1AuthAuthenticatePostRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1AuthAuthenticatePost200Response> {
1355+
apiV1AuthAuthenticatePost(apiV1AuthAuthenticatePostRequest: ApiV1AuthAuthenticatePostRequest, options?: any): AxiosPromise<ApiV1AuthAuthenticatePost200Response> {
13561356
return localVarFp.apiV1AuthAuthenticatePost(apiV1AuthAuthenticatePostRequest, options).then((request) => request(axios, basePath));
13571357
},
13581358
/**
13591359
*
13601360
* @param {*} [options] Override http request option.
13611361
* @throws {RequiredError}
13621362
*/
1363-
apiV1AuthCheckLoginStatusPost(options?: RawAxiosRequestConfig): AxiosPromise<object> {
1363+
apiV1AuthCheckLoginStatusPost(options?: any): AxiosPromise<object> {
13641364
return localVarFp.apiV1AuthCheckLoginStatusPost(options).then((request) => request(axios, basePath));
13651365
},
13661366
/**
13671367
*
13681368
* @param {*} [options] Override http request option.
13691369
* @throws {RequiredError}
13701370
*/
1371-
apiV1AuthLogoutPost(options?: RawAxiosRequestConfig): AxiosPromise<void> {
1371+
apiV1AuthLogoutPost(options?: any): AxiosPromise<void> {
13721372
return localVarFp.apiV1AuthLogoutPost(options).then((request) => request(axios, basePath));
13731373
},
13741374
/**
@@ -1377,7 +1377,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
13771377
* @param {*} [options] Override http request option.
13781378
* @throws {RequiredError}
13791379
*/
1380-
apiV1AuthVerifyOtpPost(apiV1AuthVerifyOtpPostRequest: ApiV1AuthVerifyOtpPostRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1AuthVerifyOtpPost200Response> {
1380+
apiV1AuthVerifyOtpPost(apiV1AuthVerifyOtpPostRequest: ApiV1AuthVerifyOtpPostRequest, options?: any): AxiosPromise<ApiV1AuthVerifyOtpPost200Response> {
13811381
return localVarFp.apiV1AuthVerifyOtpPost(apiV1AuthVerifyOtpPostRequest, options).then((request) => request(axios, basePath));
13821382
},
13831383
/**
@@ -1386,7 +1386,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
13861386
* @param {*} [options] Override http request option.
13871387
* @throws {RequiredError}
13881388
*/
1389-
apiV1CommentCreatePost(apiV1CommentCreatePostRequest: ApiV1CommentCreatePostRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1CommentCreatePost200Response> {
1389+
apiV1CommentCreatePost(apiV1CommentCreatePostRequest: ApiV1CommentCreatePostRequest, options?: any): AxiosPromise<ApiV1CommentCreatePost200Response> {
13901390
return localVarFp.apiV1CommentCreatePost(apiV1CommentCreatePostRequest, options).then((request) => request(axios, basePath));
13911391
},
13921392
/**
@@ -1395,7 +1395,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
13951395
* @param {*} [options] Override http request option.
13961396
* @throws {RequiredError}
13971397
*/
1398-
apiV1CommentFetchCommentsByPostSlugIdPost(apiV1CommentFetchCommentsByPostSlugIdPostRequest: ApiV1CommentFetchCommentsByPostSlugIdPostRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<ApiV1CommentFetchCommentsByPostSlugIdPost200ResponseInner>> {
1398+
apiV1CommentFetchCommentsByPostSlugIdPost(apiV1CommentFetchCommentsByPostSlugIdPostRequest: ApiV1CommentFetchCommentsByPostSlugIdPostRequest, options?: any): AxiosPromise<Array<ApiV1CommentFetchCommentsByPostSlugIdPost200ResponseInner>> {
13991399
return localVarFp.apiV1CommentFetchCommentsByPostSlugIdPost(apiV1CommentFetchCommentsByPostSlugIdPostRequest, options).then((request) => request(axios, basePath));
14001400
},
14011401
/**
@@ -1404,7 +1404,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
14041404
* @param {*} [options] Override http request option.
14051405
* @throws {RequiredError}
14061406
*/
1407-
apiV1CommentFetchToVoteOnPost(apiV1CommentFetchToVoteOnPostRequest: ApiV1CommentFetchToVoteOnPostRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1CommentFetchToVoteOnPost200Response> {
1407+
apiV1CommentFetchToVoteOnPost(apiV1CommentFetchToVoteOnPostRequest: ApiV1CommentFetchToVoteOnPostRequest, options?: any): AxiosPromise<ApiV1CommentFetchToVoteOnPost200Response> {
14081408
return localVarFp.apiV1CommentFetchToVoteOnPost(apiV1CommentFetchToVoteOnPostRequest, options).then((request) => request(axios, basePath));
14091409
},
14101410
/**
@@ -1413,7 +1413,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
14131413
* @param {*} [options] Override http request option.
14141414
* @throws {RequiredError}
14151415
*/
1416-
apiV1FeedFetchRecentPost(apiV1FeedFetchRecentPostRequest: ApiV1FeedFetchRecentPostRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<ApiV1FeedFetchRecentPost200ResponseInner>> {
1416+
apiV1FeedFetchRecentPost(apiV1FeedFetchRecentPostRequest: ApiV1FeedFetchRecentPostRequest, options?: any): AxiosPromise<Array<ApiV1FeedFetchRecentPost200ResponseInner>> {
14171417
return localVarFp.apiV1FeedFetchRecentPost(apiV1FeedFetchRecentPostRequest, options).then((request) => request(axios, basePath));
14181418
},
14191419
/**
@@ -1422,7 +1422,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
14221422
* @param {*} [options] Override http request option.
14231423
* @throws {RequiredError}
14241424
*/
1425-
apiV1PollGetUserPollResponsePost(apiV1VotingFetchUserVotesForPostSlugIdPostRequest: ApiV1VotingFetchUserVotesForPostSlugIdPostRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1PollGetUserPollResponsePost200Response> {
1425+
apiV1PollGetUserPollResponsePost(apiV1VotingFetchUserVotesForPostSlugIdPostRequest: ApiV1VotingFetchUserVotesForPostSlugIdPostRequest, options?: any): AxiosPromise<ApiV1PollGetUserPollResponsePost200Response> {
14261426
return localVarFp.apiV1PollGetUserPollResponsePost(apiV1VotingFetchUserVotesForPostSlugIdPostRequest, options).then((request) => request(axios, basePath));
14271427
},
14281428
/**
@@ -1431,7 +1431,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
14311431
* @param {*} [options] Override http request option.
14321432
* @throws {RequiredError}
14331433
*/
1434-
apiV1PollSubmitResponsePost(apiV1PollSubmitResponsePostRequest: ApiV1PollSubmitResponsePostRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
1434+
apiV1PollSubmitResponsePost(apiV1PollSubmitResponsePostRequest: ApiV1PollSubmitResponsePostRequest, options?: any): AxiosPromise<void> {
14351435
return localVarFp.apiV1PollSubmitResponsePost(apiV1PollSubmitResponsePostRequest, options).then((request) => request(axios, basePath));
14361436
},
14371437
/**
@@ -1440,7 +1440,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
14401440
* @param {*} [options] Override http request option.
14411441
* @throws {RequiredError}
14421442
*/
1443-
apiV1PostCreatePost(apiV1PostCreatePostRequest: ApiV1PostCreatePostRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1VotingFetchUserVotesForPostSlugIdPostRequest> {
1443+
apiV1PostCreatePost(apiV1PostCreatePostRequest: ApiV1PostCreatePostRequest, options?: any): AxiosPromise<ApiV1VotingFetchUserVotesForPostSlugIdPostRequest> {
14441444
return localVarFp.apiV1PostCreatePost(apiV1PostCreatePostRequest, options).then((request) => request(axios, basePath));
14451445
},
14461446
/**
@@ -1449,7 +1449,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
14491449
* @param {*} [options] Override http request option.
14501450
* @throws {RequiredError}
14511451
*/
1452-
apiV1PostFetchPostBySlugIdPost(apiV1PostFetchPostBySlugIdPostRequest: ApiV1PostFetchPostBySlugIdPostRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiV1PostFetchPostBySlugIdPost200Response> {
1452+
apiV1PostFetchPostBySlugIdPost(apiV1PostFetchPostBySlugIdPostRequest: ApiV1PostFetchPostBySlugIdPostRequest, options?: any): AxiosPromise<ApiV1PostFetchPostBySlugIdPost200Response> {
14531453
return localVarFp.apiV1PostFetchPostBySlugIdPost(apiV1PostFetchPostBySlugIdPostRequest, options).then((request) => request(axios, basePath));
14541454
},
14551455
/**
@@ -1458,7 +1458,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
14581458
* @param {*} [options] Override http request option.
14591459
* @throws {RequiredError}
14601460
*/
1461-
apiV1VotingCastVotePost(apiV1VotingCastVotePostRequest: ApiV1VotingCastVotePostRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
1461+
apiV1VotingCastVotePost(apiV1VotingCastVotePostRequest: ApiV1VotingCastVotePostRequest, options?: any): AxiosPromise<void> {
14621462
return localVarFp.apiV1VotingCastVotePost(apiV1VotingCastVotePostRequest, options).then((request) => request(axios, basePath));
14631463
},
14641464
/**
@@ -1467,7 +1467,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
14671467
* @param {*} [options] Override http request option.
14681468
* @throws {RequiredError}
14691469
*/
1470-
apiV1VotingFetchUserVotesForPostSlugIdPost(apiV1VotingFetchUserVotesForPostSlugIdPostRequest: ApiV1VotingFetchUserVotesForPostSlugIdPostRequest, options?: RawAxiosRequestConfig): AxiosPromise<Array<ApiV1VotingFetchUserVotesForPostSlugIdPost200ResponseInner>> {
1470+
apiV1VotingFetchUserVotesForPostSlugIdPost(apiV1VotingFetchUserVotesForPostSlugIdPostRequest: ApiV1VotingFetchUserVotesForPostSlugIdPostRequest, options?: any): AxiosPromise<Array<ApiV1VotingFetchUserVotesForPostSlugIdPost200ResponseInner>> {
14711471
return localVarFp.apiV1VotingFetchUserVotesForPostSlugIdPost(apiV1VotingFetchUserVotesForPostSlugIdPostRequest, options).then((request) => request(axios, basePath));
14721472
},
14731473
};

services/agora/src/utils/api/auth.ts

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import axios from "axios";
1010
import { buildAuthorizationHeader } from "../crypto/ucan/operation";
1111
import { useCommonApi } from "./common";
1212
import { useAuthenticationStore } from "src/stores/authentication";
13+
import { usePostStore } from "src/stores/post";
1314

1415
interface AuthenticateReturn {
1516
isSuccessful: boolean;
@@ -20,6 +21,7 @@ interface AuthenticateReturn {
2021
export function useBackendAuthApi() {
2122
const { buildEncodedUcan } = useCommonApi();
2223
const { userLogout } = useAuthenticationStore();
24+
const { loadPostData } = usePostStore();
2325

2426
async function sendEmailCode(
2527
email: string,
@@ -181,6 +183,8 @@ export function useBackendAuthApi() {
181183
userLogout();
182184
}
183185
}
186+
187+
loadPostData(false);
184188
}, 1000);
185189
}
186190

services/api/src/service/feed.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { ExtendedPost } from "@/shared/types/zod.js";
33
import { and, eq, lt } from "drizzle-orm";
44
import { type PostgresJsDatabase as PostgresDatabase } from "drizzle-orm/postgres-js";
55
import { useCommonPost } from "./common.js";
6-
import { httpErrors } from "@fastify/sensible";
76

87
interface FetchFeedProps {
98
db: PostgresDatabase;
@@ -31,7 +30,7 @@ export async function fetchFeed({
3130
if (selectResponse.length == 1) {
3231
lastCreatedAt = selectResponse[0].createdAt;
3332
} else {
34-
throw httpErrors.badRequest("An invalid slug ID had been specified for the fetch feed request: " + lastSlugId);
33+
// Ignore the slug ID if it cannot be found
3534
}
3635
}
3736

0 commit comments

Comments
 (0)