From 40050fa2228e6ac6af7d02237229094182ff960b Mon Sep 17 00:00:00 2001 From: Michael Clapham Date: Tue, 27 Aug 2024 16:10:56 +0100 Subject: [PATCH] Update types with payload and times as strings --- models.ts | 10 +++++----- msg_types.go | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/models.ts b/models.ts index 426672d..0334bc7 100644 --- a/models.ts +++ b/models.ts @@ -4,6 +4,7 @@ export namespace ServerTypes { export interface Client { id: string; name: string; + lastJoinTime: string; } export interface Session { id: string; @@ -16,7 +17,6 @@ export namespace ServerTypes { } export interface CreateSessionMsg { type: "CreateSession"; - addClientId: string; } export interface UpdateClientMsg { type: "UpdateClient"; @@ -32,24 +32,24 @@ export namespace ServerTypes { clientId: string; sessionId: string; sessionOwnerId: string; - clientMap: { [key: string]: Client }; + clientMap: {[key: string]: Client}; } export interface ClientLeftSessionMsg { type: "ClientLeftSession"; clientId: string; sessionId: string; sessionOwnerId: string; - clientMap: { [key: string]: Client }; + clientMap: {[key: string]: Client}; } export interface BroadcastToSessionMsg { type: "BroadcastToSession"; - payload: any; + payload: string; } export interface BroadcastFromSessionMsg { type: "BroadcastFromSession"; fromSessionOwner: boolean; senderId: string; - payload: any; + payload: string; } export interface ErrorMsg { type: "Error"; diff --git a/msg_types.go b/msg_types.go index 6c2c23b..5e4e34f 100644 --- a/msg_types.go +++ b/msg_types.go @@ -26,6 +26,9 @@ func convertToTS() { Add(InfoMsg{}) converter.CreateInterface = true + converter.ManageType(time.Time{}, typescriptify.TypeOptions{ + TSType: "string", + }) converter.BackupDir = "" tsString, err := converter.Convert(make(map[string]string)) if err != nil {