work on the list call
This commit is contained in:
@@ -8,6 +8,8 @@ import {
|
||||
Character,
|
||||
GetCharacterRequest,
|
||||
CreateCharacterRequest,
|
||||
ListCharacterRequest,
|
||||
ListCharacterResponse,
|
||||
} from './proto/character'
|
||||
|
||||
import {
|
||||
@@ -15,6 +17,15 @@ import {
|
||||
ICharacterManager,
|
||||
} from './proto/character.grpc-server'
|
||||
|
||||
const testCharacter: Character = {
|
||||
playerName: 'test player',
|
||||
characterName: 'test character',
|
||||
characterAlias: ['test alias'],
|
||||
version: 'test version',
|
||||
sourceTable: 'source table',
|
||||
json: 'test json',
|
||||
}
|
||||
|
||||
export class CharacterService {
|
||||
reflectionService: ReflectionService
|
||||
characterManager: ICharacterManager
|
||||
@@ -28,6 +39,7 @@ export class CharacterService {
|
||||
this.characterManager = {
|
||||
createCharacter: this.createCharacterCall.bind(this),
|
||||
getCharacter: this.getCharacterCall.bind(this),
|
||||
listCharacters: this.listCharactersCall.bind(this),
|
||||
}
|
||||
|
||||
this.databaseService = databaseService
|
||||
@@ -49,21 +61,27 @@ export class CharacterService {
|
||||
|
||||
console.log(newCharacter)
|
||||
|
||||
callback(null, {
|
||||
playerName: newCharacter.playerName,
|
||||
characterName: newCharacter.characterName,
|
||||
characterAlias: newCharacter.characterAlias,
|
||||
})
|
||||
callback(null, newCharacter)
|
||||
}
|
||||
|
||||
getCharacterCall(
|
||||
call: ServerUnaryCall<GetCharacterRequest, Character>,
|
||||
callback: sendUnaryData<Character>,
|
||||
) {
|
||||
callback(null, testCharacter)
|
||||
}
|
||||
|
||||
async listCharactersCall(
|
||||
call: ServerUnaryCall<ListCharacterRequest, ListCharacterResponse>,
|
||||
callback: sendUnaryData<ListCharacterResponse>,
|
||||
) {
|
||||
let characters = await this.databaseService.listCharacters(
|
||||
call.request.playerName,
|
||||
call.request.characterName,
|
||||
)
|
||||
|
||||
callback(null, {
|
||||
playerName: 'test player',
|
||||
characterName: 'test character',
|
||||
characterAlias: ['test alias'],
|
||||
characters,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user