fix: more grpc build issues

This commit is contained in:
William Oldham 2026-04-20 21:50:00 +01:00
parent 30d704e1f3
commit fa50d865ed
3 changed files with 45 additions and 5 deletions

View File

@ -19,6 +19,7 @@ export async function getUserData(request: GetUserDataRequest): Promise<GetUserD
linked_pids: pnid.pid
})).map((device) => {
return {
deviceId: device.device_id,
model: device.get('model'), // ".model" gives the Mongoose model...
serial: device.serial,
linkedPids: device.linked_pids,

View File

@ -1,15 +1,55 @@
import { ServerError, Status } from 'nice-grpc';
import { getUserData } from '@/services/grpc/account/v2/get-user-data';
import { getNEXPassword } from '@/services/grpc/account/v2/get-nex-password';
import { getNEXData } from '@/services/grpc/account/v2/get-nex-data';
import { updatePNIDPermissions } from '@/services/grpc/account/v2/update-pnid-permissions';
import { exchangeTokenForUserData } from '@/services/grpc/account/v2/exchange-token-for-user-data';
import { deleteAccount } from '@/services/grpc/account/v2/delete-account';
import type { ServiceImplementation } from 'nice-grpc';
import type { AccountServiceDefinition } from '@pretendonetwork/grpc/account/v2/account_service';
export const accountServiceImplementationV2 = {
const notImplemented = (): never => {
throw new ServerError(Status.UNIMPLEMENTED, 'Not implemented');
};
export const accountServiceImplementationV2: ServiceImplementation<AccountServiceDefinition> = {
getUserData,
getNEXPassword,
getNEXData,
updatePNIDPermissions,
exchangeTokenForUserData,
deleteAccount
deleteAccount,
// The following methods are not yet implemented
createAuditLogComment: notImplemented,
createBanComment: notImplemented,
createServer: notImplemented,
deleteServer: notImplemented,
deletePNID: notImplemented,
exchangeIndependentServiceTokenForUserData: notImplemented,
exchangeNEXTokenForUserData: notImplemented,
exchangeOAuthTokenForUserData: notImplemented,
exchangePasswordResetTokenForUserData: notImplemented,
getBan: notImplemented,
getDevice: notImplemented,
getNEXAccount: notImplemented,
getPNID: notImplemented,
getServer: notImplemented,
getPNIDs: notImplemented,
issueBan: notImplemented,
listAuditLogComments: notImplemented,
listBans: notImplemented,
listDevices: notImplemented,
listNEXAccounts: notImplemented,
listPNIDs: notImplemented,
listServers: notImplemented,
listAuditLogs: notImplemented,
listBanComments: notImplemented,
pardonBan: notImplemented,
updateBan: notImplemented,
updateDevice: notImplemented,
updateNEXAccount: notImplemented,
updateServer: notImplemented,
updatePNID: notImplemented,
validateIndependentServiceToken: notImplemented
};

View File

@ -1,10 +1,9 @@
import { Status, ServerError } from 'nice-grpc';
import { getPNIDByPID } from '@/database';
import { PNID_PERMISSION_FLAGS } from '@/types/common/permission-flags';
import type { UpdatePNIDPermissionsRequest } from '@pretendonetwork/grpc/account/v2/update_pnid_permissions_rpc';
import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty';
import type { UpdatePNIDPermissionsRequest, UpdatePNIDPermissionsResponse } from '@pretendonetwork/grpc/account/v2/update_pnid_permissions_rpc';
export async function updatePNIDPermissions(request: UpdatePNIDPermissionsRequest): Promise<Empty> {
export async function updatePNIDPermissions(request: UpdatePNIDPermissionsRequest): Promise<UpdatePNIDPermissionsResponse> {
const pnid = await getPNIDByPID(request.pid);
if (!pnid) {