Skip to content

Commit

Permalink
Remove unused access level fields
Browse files Browse the repository at this point in the history
  • Loading branch information
binaryoverload committed Jan 23, 2025
1 parent d170450 commit 52b6c9b
Show file tree
Hide file tree
Showing 8 changed files with 419 additions and 173 deletions.
566 changes: 411 additions & 155 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies": {
"@aws-sdk/client-s3": "^3.657.0",
"@aws-sdk/client-ses": "^3.515.0",
"@pretendonetwork/grpc": "^1.0.5",
"@pretendonetwork/grpc": "^2.0.1",
"bcrypt": "^5.0.0",
"buffer-crc32": "^0.2.13",
"colors": "^1.4.0",
Expand Down Expand Up @@ -84,4 +84,4 @@
"ndarray": "^1.0.19",
"typescript": "^4.9.5"
}
}
}
2 changes: 1 addition & 1 deletion src/services/grpc/account/update-pnid-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Status, ServerError } from 'nice-grpc';
import { UpdatePNIDPermissionsRequest } from '@pretendonetwork/grpc/account/update_pnid_permissions';
import { getPNIDByPID } from '@/database';
import { PNID_PERMISSION_FLAGS } from '@/types/common/permission-flags';
import type { Empty } from '@pretendonetwork/grpc/api/google/protobuf/empty';
import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty';

export async function updatePNIDPermissions(request: UpdatePNIDPermissionsRequest): Promise<Empty> {
const pnid = await getPNIDByPID(request.pid);
Expand Down
2 changes: 1 addition & 1 deletion src/services/grpc/api/forgot-password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import validator from 'validator';
import { ForgotPasswordRequest } from '@pretendonetwork/grpc/api/forgot_password_rpc';
import { getPNIDByEmailAddress, getPNIDByUsername } from '@/database';
import { sendForgotPasswordEmail } from '@/util';
import type { Empty } from '@pretendonetwork/grpc/api/google/protobuf/empty';
import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty';
import type { HydratedPNIDDocument } from '@/types/mongoose/pnid';

export async function forgotPassword(request: ForgotPasswordRequest): Promise<Empty> {
Expand Down
2 changes: 1 addition & 1 deletion src/services/grpc/api/get-user-data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CallContext } from 'nice-grpc';
import { GetUserDataResponse, DeepPartial } from '@pretendonetwork/grpc/api/get_user_data_rpc';
import { config } from '@/config-manager';
import type { Empty } from '@pretendonetwork/grpc/api/google/protobuf/empty';
import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty';
import type { AuthenticationCallContextExt } from '@/services/grpc/api/authentication-middleware';

export async function getUserData(_request: Empty, context: CallContext & AuthenticationCallContextExt): Promise<DeepPartial<GetUserDataResponse>> {
Expand Down
2 changes: 1 addition & 1 deletion src/services/grpc/api/reset-password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Status, ServerError } from 'nice-grpc';
import { ResetPasswordRequest } from '@pretendonetwork/grpc/api/reset_password_rpc';
import { decryptToken, unpackToken, nintendoPasswordHash } from '@/util';
import { getPNIDByPID } from '@/database';
import type { Empty } from '@pretendonetwork/grpc/api/google/protobuf/empty';
import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty';
import type { Token } from '@/types/common/token';

// * This sucks
Expand Down
2 changes: 1 addition & 1 deletion src/services/grpc/api/set-discord-connection-data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Status, ServerError, CallContext } from 'nice-grpc';
import { SetDiscordConnectionDataRequest } from '@pretendonetwork/grpc/api/set_discord_connection_data_rpc';
import type { Empty } from '@pretendonetwork/grpc/api/google/protobuf/empty';
import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty';
import type { AuthenticationCallContextExt } from '@/services/grpc/api/authentication-middleware';

export async function setDiscordConnectionData(request: SetDiscordConnectionDataRequest, context: CallContext & AuthenticationCallContextExt): Promise<Empty>{
Expand Down
12 changes: 1 addition & 11 deletions src/services/grpc/api/set-stripe-connection-data.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Status, ServerError, CallContext } from 'nice-grpc';
import { SetStripeConnectionDataRequest } from '@pretendonetwork/grpc/api/set_stripe_connection_data_rpc';
import { PNID } from '@/models/pnid';
import type { Empty } from '@pretendonetwork/grpc/api/google/protobuf/empty';
import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty';
import type { AuthenticationCallContextExt } from '@/services/grpc/api/authentication-middleware';

type StripeMongoUpdateScheme = {
access_level?: number;
server_access_level?: string;
'connections.stripe.customer_id'?: string;
'connections.stripe.subscription_id'?: string;
'connections.stripe.price_id'?: string;
Expand All @@ -29,14 +27,6 @@ export async function setStripeConnectionData(request: SetStripeConnectionDataRe

// * These checks allow for null/0 values in order to reset data if needed

if (request.accessLevel !== undefined) {
updateData.access_level = request.accessLevel;
}

if (request.serverAccessLevel !== undefined) {
updateData.server_access_level = request.serverAccessLevel;
}

if (request.subscriptionId !== undefined) {
updateData['connections.stripe.subscription_id'] = request.subscriptionId;
}
Expand Down

0 comments on commit 52b6c9b

Please sign in to comment.