Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delete account API #127

Merged
merged 20 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions services/agora/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@
"buffer": "^6.0.3",
"cborg": "^4.2.0",
"libphonenumber-js": "^1.11.10",
"localforage": "^1.10.0",
"multiformats": "^13.3.0",
"pinia": "^2.2.6",
"pinia-plugin-persistedstate-2": "^2.0.26",
"primevue": "^4.0.7",
"qrcode": "^1",
"quasar": "^2.17.4",
Expand Down
2 changes: 1 addition & 1 deletion services/agora/src/api/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6.0
7.7.0
165 changes: 159 additions & 6 deletions services/agora/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,17 +388,24 @@ export interface ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadata {
'commentCount': number;
/**
*
* @type {string}
* @type {ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadataAuthorUserName}
* @memberof ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadata
*/
'authorUserName': string;
'authorUserName': ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadataAuthorUserName;
/**
*
* @type {string}
* @memberof ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadata
*/
'authorImagePath'?: string;
}
/**
*
* @export
* @interface ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadataAuthorUserName
*/
export interface ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadataAuthorUserName {
}
/**
*
* @export
Expand Down Expand Up @@ -474,6 +481,19 @@ export interface ApiV1FeedFetchRecentPostRequest {
*/
'isAuthenticatedRequest': boolean;
}
/**
*
* @export
* @interface ApiV1OnboardingIsUsernameInUsePostRequest
*/
export interface ApiV1OnboardingIsUsernameInUsePostRequest {
/**
*
* @type {ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadataAuthorUserName}
* @memberof ApiV1OnboardingIsUsernameInUsePostRequest
*/
'userName': ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadataAuthorUserName;
}
/**
*
* @export
Expand Down Expand Up @@ -747,10 +767,10 @@ export interface ApiV1UserFetchUserCommentsPost200ResponseInnerCommentItem {
'numDislikes': number;
/**
*
* @type {string}
* @type {ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadataAuthorUserName}
* @memberof ApiV1UserFetchUserCommentsPost200ResponseInnerCommentItem
*/
'userName': string;
'userName': ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadataAuthorUserName;
}
/**
*
Expand Down Expand Up @@ -798,10 +818,10 @@ export interface ApiV1UserFetchUserProfilePost200Response {
'createdAt': string;
/**
*
* @type {string}
* @type {ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadataAuthorUserName}
* @memberof ApiV1UserFetchUserProfilePost200Response
*/
'userName': string;
'userName': ApiV1FeedFetchRecentPost200ResponsePostDataListInnerMetadataAuthorUserName;
}
/**
*
Expand Down Expand Up @@ -878,6 +898,39 @@ export interface ApiV1VotingFetchUserVotesForPostSlugIdsPostRequest {
*/
export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiV1AccountDeleteUserPost: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/v1/account/delete-user`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}

const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

// authentication BearerAuth required
// http bearer authentication required
await setBearerAuthToObject(localVarHeaderParameter, configuration)



setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {ApiV1AuthAuthenticatePostRequest} apiV1AuthAuthenticatePostRequest
Expand Down Expand Up @@ -1178,6 +1231,45 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
options: localVarRequestOptions,
};
},
/**
*
* @param {ApiV1OnboardingIsUsernameInUsePostRequest} apiV1OnboardingIsUsernameInUsePostRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiV1OnboardingIsUsernameInUsePost: async (apiV1OnboardingIsUsernameInUsePostRequest: ApiV1OnboardingIsUsernameInUsePostRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'apiV1OnboardingIsUsernameInUsePostRequest' is not null or undefined
assertParamExists('apiV1OnboardingIsUsernameInUsePost', 'apiV1OnboardingIsUsernameInUsePostRequest', apiV1OnboardingIsUsernameInUsePostRequest)
const localVarPath = `/api/v1/onboarding/is_username_in_use`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}

const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

// authentication BearerAuth required
// http bearer authentication required
await setBearerAuthToObject(localVarHeaderParameter, configuration)



localVarHeaderParameter['Content-Type'] = 'application/json';

setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(apiV1OnboardingIsUsernameInUsePostRequest, localVarRequestOptions, configuration)

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {Array<string>} [requestBody]
Expand Down Expand Up @@ -1632,6 +1724,17 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
export const DefaultApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration)
return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiV1AccountDeleteUserPost(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1AccountDeleteUserPost(options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DefaultApi.apiV1AccountDeleteUserPost']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @param {ApiV1AuthAuthenticatePostRequest} apiV1AuthAuthenticatePostRequest
Expand Down Expand Up @@ -1726,6 +1829,18 @@ export const DefaultApiFp = function(configuration?: Configuration) {
const localVarOperationServerBasePath = operationServerMap['DefaultApi.apiV1FeedFetchRecentPost']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @param {ApiV1OnboardingIsUsernameInUsePostRequest} apiV1OnboardingIsUsernameInUsePostRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiV1OnboardingIsUsernameInUsePost(apiV1OnboardingIsUsernameInUsePostRequest: ApiV1OnboardingIsUsernameInUsePostRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<boolean>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.apiV1OnboardingIsUsernameInUsePost(apiV1OnboardingIsUsernameInUsePostRequest, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DefaultApi.apiV1OnboardingIsUsernameInUsePost']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @param {Array<string>} [requestBody]
Expand Down Expand Up @@ -1877,6 +1992,14 @@ export const DefaultApiFp = function(configuration?: Configuration) {
export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = DefaultApiFp(configuration)
return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiV1AccountDeleteUserPost(options?: any): AxiosPromise<void> {
return localVarFp.apiV1AccountDeleteUserPost(options).then((request) => request(axios, basePath));
},
/**
*
* @param {ApiV1AuthAuthenticatePostRequest} apiV1AuthAuthenticatePostRequest
Expand Down Expand Up @@ -1947,6 +2070,15 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
apiV1FeedFetchRecentPost(apiV1FeedFetchRecentPostRequest: ApiV1FeedFetchRecentPostRequest, options?: any): AxiosPromise<ApiV1FeedFetchRecentPost200Response> {
return localVarFp.apiV1FeedFetchRecentPost(apiV1FeedFetchRecentPostRequest, options).then((request) => request(axios, basePath));
},
/**
*
* @param {ApiV1OnboardingIsUsernameInUsePostRequest} apiV1OnboardingIsUsernameInUsePostRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiV1OnboardingIsUsernameInUsePost(apiV1OnboardingIsUsernameInUsePostRequest: ApiV1OnboardingIsUsernameInUsePostRequest, options?: any): AxiosPromise<boolean> {
return localVarFp.apiV1OnboardingIsUsernameInUsePost(apiV1OnboardingIsUsernameInUsePostRequest, options).then((request) => request(axios, basePath));
},
/**
*
* @param {Array<string>} [requestBody]
Expand Down Expand Up @@ -2062,6 +2194,16 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
* @extends {BaseAPI}
*/
export class DefaultApi extends BaseAPI {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DefaultApi
*/
public apiV1AccountDeleteUserPost(options?: RawAxiosRequestConfig) {
return DefaultApiFp(this.configuration).apiV1AccountDeleteUserPost(options).then((request) => request(this.axios, this.basePath));
}

/**
*
* @param {ApiV1AuthAuthenticatePostRequest} apiV1AuthAuthenticatePostRequest
Expand Down Expand Up @@ -2148,6 +2290,17 @@ export class DefaultApi extends BaseAPI {
return DefaultApiFp(this.configuration).apiV1FeedFetchRecentPost(apiV1FeedFetchRecentPostRequest, options).then((request) => request(this.axios, this.basePath));
}

/**
*
* @param {ApiV1OnboardingIsUsernameInUsePostRequest} apiV1OnboardingIsUsernameInUsePostRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DefaultApi
*/
public apiV1OnboardingIsUsernameInUsePost(apiV1OnboardingIsUsernameInUsePostRequest: ApiV1OnboardingIsUsernameInUsePostRequest, options?: RawAxiosRequestConfig) {
return DefaultApiFp(this.configuration).apiV1OnboardingIsUsernameInUsePost(apiV1OnboardingIsUsernameInUsePostRequest, options).then((request) => request(this.axios, this.basePath));
}

/**
*
* @param {Array<string>} [requestBody]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import { useAuthenticationStore } from "src/stores/authentication";
import { useRouter } from "vue-router";
import ZKButton from "../ui-library/ZKButton.vue";
import { useBackendPhoneVerification } from "src/utils/api/phoneVerification";
import { storeToRefs } from "pinia";

const router = useRouter();
const {
isAuthenticated,
verificationPhoneNumber,
verificationDefaultCallingCode,
} = useAuthenticationStore();
} = storeToRefs(useAuthenticationStore());
const phoneVerification = useBackendPhoneVerification();

async function skipButton() {
Expand Down
3 changes: 2 additions & 1 deletion services/agora/src/components/footer/FooterBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
</template>

<script setup lang="ts">
import { storeToRefs } from "pinia";
import { useAuthenticationStore } from "src/stores/authentication";
import { useDialog } from "src/utils/ui/dialog";
import { useRoute, useRouter } from "vue-router";

const { isAuthenticated } = useAuthenticationStore();
const { isAuthenticated } = storeToRefs(useAuthenticationStore());

const dialog = useDialog();

Expand Down
3 changes: 2 additions & 1 deletion services/agora/src/components/navigation/DefaultMenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ import TopMenuWrapper from "./TopMenuWrapper.vue";
import { useAuthenticationStore } from "src/stores/authentication";
import { onMounted, ref } from "vue";
import CloseButton from "./buttons/CloseButton.vue";
import { storeToRefs } from "pinia";

defineProps<DefaultMenuBarProps>();

const { isAuthenticated } = useAuthenticationStore();
const { isAuthenticated } = storeToRefs(useAuthenticationStore());

const showAuthButton = ref(false);

Expand Down
3 changes: 2 additions & 1 deletion services/agora/src/components/poll/PollWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { useAuthenticationStore } from "src/stores/authentication";
import { useBackendPollApi } from "src/utils/api/poll";
import { useDialog } from "src/utils/ui/dialog";
import type { UserInteraction, PollList } from "src/shared/types/zod";
import { storeToRefs } from "pinia";

const props = defineProps<{
userResponse: UserInteraction;
Expand All @@ -58,7 +59,7 @@ const dataLoaded = ref(false);

const backendPollApi = useBackendPollApi();
const { showMessage } = useDialog();
const { isAuthenticated } = useAuthenticationStore();
const { isAuthenticated } = storeToRefs(useAuthenticationStore());
const { loadPostData } = usePostStore();

enum DisplayModes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { computed, ref } from "vue";
import { type CommentItem, type VotingAction } from "src/shared/types/zod";
import { useAuthenticationStore } from "src/stores/authentication";
import { useDialog } from "src/utils/ui/dialog";
import { storeToRefs } from "pinia";

const emit = defineEmits(["deleted"])

Expand All @@ -50,7 +51,7 @@ const webShare = useWebShare();
const { showLoginConfirmationDialog } = useDialog();

const { castVoteForComment } = useBackendVoteApi();
const { isAuthenticated } = useAuthenticationStore();
const { isAuthenticated } = storeToRefs(useAuthenticationStore());

const numLikesLocal = ref(props.commentItem.numLikes);
const numDislikesLocal = ref(props.commentItem.numDislikes);
Expand Down
3 changes: 2 additions & 1 deletion services/agora/src/components/post/views/CommentSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { useBackendCommentApi } from "src/utils/api/comment";
import { useBackendVoteApi } from "src/utils/api/vote";
import { useAuthenticationStore } from "src/stores/authentication";
import { type CommentItem } from "src/shared/types/zod";
import { storeToRefs } from "pinia";

const emit = defineEmits(["deleted"])

Expand All @@ -54,7 +55,7 @@ const commentSortPreference = ref("");
const { fetchCommentsForPost } = useBackendCommentApi();
const { fetchUserVotesForPostSlugIds } = useBackendVoteApi();

const { isAuthenticated } = useAuthenticationStore();
const { isAuthenticated } = storeToRefs(useAuthenticationStore());

const commentItems = ref<CommentItem[]>([]);

Expand Down
6 changes: 5 additions & 1 deletion services/agora/src/components/settings/SettingsSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div v-for="(item, index) in settingsItemList" :key="item.icon">
<ZKHoverEffect :enable-hover="true">
<RouterLink :to="{ name: item.routeName }">
<div class="menuItem" @click="item.action">
<div class="menuItem" :class="{ isWarningStyle: item.isWarning }" @click="item.action">
<div>
<q-icon :name="item.icon" size="1.5rem" />
</div>
Expand Down Expand Up @@ -65,4 +65,8 @@ defineProps<{
.container {
padding-bottom: 2rem;
}

.isWarningStyle {
color: #b91c1c;
}
</style>
Loading