mirror of
https://github.com/PretendoNetwork/account.git
synced 2026-04-25 07:22:47 -05:00
Add GetNEXData GRPC method
Returns all details of a NEX account.
This commit is contained in:
parent
06c9cc9c01
commit
3844531191
10
package-lock.json
generated
10
package-lock.json
generated
|
|
@ -1175,11 +1175,6 @@
|
|||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/async": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
|
||||
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
|
|
@ -4384,12 +4379,11 @@
|
|||
}
|
||||
},
|
||||
"node_modules/pretendo-grpc-ts": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "git+ssh://git@github.com/PretendoNetwork/grpc-ts.git#64c83180d1f2d0829fd8d5e0e6305c6c019b1f03",
|
||||
"version": "1.0.3",
|
||||
"resolved": "git+ssh://git@github.com/PretendoNetwork/grpc-ts.git#8047b4d49c9a27cc7edd3786b465c3b0939b6181",
|
||||
"hasInstallScript": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"async": "^3.2.4",
|
||||
"long": "^5.2.1",
|
||||
"protobufjs": "^7.2.3"
|
||||
}
|
||||
|
|
|
|||
24
src/services/grpc/account/get-nex-data.ts
Normal file
24
src/services/grpc/account/get-nex-data.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { Status, ServerError } from 'nice-grpc';
|
||||
import {GetNEXDataRequest,GetNEXDataResponse, DeepPartial } from 'pretendo-grpc-ts/dist/account/get_nex_data_rpc';
|
||||
import { NEXAccount } from '@/models/nex-account';
|
||||
import { HydratedNEXAccountDocument } from '@/types/mongoose/nex-account';
|
||||
|
||||
export async function getNEXData(request: GetNEXDataRequest): Promise<DeepPartial<GetNEXDataResponse>> {
|
||||
const nexAccount: HydratedNEXAccountDocument | null = await NEXAccount.findOne({ pid: request.pid });
|
||||
|
||||
if (!nexAccount) {
|
||||
throw new ServerError(
|
||||
Status.INVALID_ARGUMENT,
|
||||
'No NEX account found found',
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
pid: nexAccount.pid,
|
||||
password: nexAccount.password,
|
||||
owningPid: nexAccount.owning_pid,
|
||||
accessLevel: nexAccount.access_level,
|
||||
serverAccessLevel: nexAccount.server_access_level,
|
||||
friendCode: nexAccount.friend_code
|
||||
};
|
||||
}
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
import { AccountServiceImplementation } from 'pretendo-grpc-ts/dist/account/account_service';
|
||||
import { getUserData } from '@/services/grpc/account/get-user-data';
|
||||
import { getNEXPassword } from '@/services/grpc/account/get-nex-password';
|
||||
import { getNEXData } from '@/services/grpc/account/get-nex-data';
|
||||
|
||||
export const accountServiceImplementation: AccountServiceImplementation = {
|
||||
getUserData,
|
||||
getNEXPassword
|
||||
};
|
||||
getNEXPassword,
|
||||
getNEXData
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user