make use of proto well knows types
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
||||
import { ClientReadableStream } from "grpc";
|
||||
import { PositionDispatcher } from "_Model/PositionDispatcher";
|
||||
import Debug from "debug";
|
||||
import { BoolValue, UInt32Value } from "google-protobuf/google/protobuf/wrappers_pb";
|
||||
|
||||
const debug = Debug("zone");
|
||||
|
||||
@@ -125,9 +126,9 @@ export class UserDescriptor {
|
||||
export class GroupDescriptor {
|
||||
private constructor(
|
||||
public readonly groupId: number,
|
||||
private groupSize: number,
|
||||
private groupSize: number | undefined,
|
||||
private position: PointMessage,
|
||||
private locked: boolean
|
||||
private locked: boolean | undefined
|
||||
) {}
|
||||
|
||||
public static createFromGroupUpdateZoneMessage(message: GroupUpdateZoneMessage): GroupDescriptor {
|
||||
@@ -150,9 +151,13 @@ export class GroupDescriptor {
|
||||
throw new Error("GroupDescriptor.groupId is not an integer: " + this.groupId);
|
||||
}
|
||||
groupUpdateMessage.setGroupid(this.groupId);
|
||||
groupUpdateMessage.setGroupsize(this.groupSize);
|
||||
if (this.groupSize !== undefined) {
|
||||
groupUpdateMessage.setGroupsize(new UInt32Value().setValue(this.groupSize));
|
||||
}
|
||||
groupUpdateMessage.setPosition(this.position);
|
||||
groupUpdateMessage.setLocked(this.locked);
|
||||
if (this.locked !== undefined) {
|
||||
groupUpdateMessage.setLocked(new BoolValue().setValue(this.locked));
|
||||
}
|
||||
return groupUpdateMessage;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user