Skip to content

Commit

Permalink
fix: timestamp type to number
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur12-1610 committed Apr 22, 2024
1 parent 4e5bacb commit 57ceaa9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
56 changes: 28 additions & 28 deletions packages/restapi/src/lib/pushstream/DataModifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class DataModifier {
): JoinGroupEvent {
const baseEventData: JoinGroupEvent = {
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
chatId: data.chatId,
from: data.from,
to: data.to,
Expand All @@ -78,7 +78,7 @@ export class DataModifier {
): LeaveGroupEvent {
const baseEventData: LeaveGroupEvent = {
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
chatId: data.chatId,
from: data.from,
to: data.to,
Expand All @@ -96,7 +96,7 @@ export class DataModifier {
private static mapToRequestEvent(data: any, includeRaw: boolean): any {
const eventData: RequestEvent = {
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
chatId: data.chatId,
from: data.from,
to: data.to,
Expand All @@ -116,7 +116,7 @@ export class DataModifier {
// Whatever the structure of your RemoveEvent, modify accordingly
const eventData: RemoveEvent = {
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
chatId: data.chatId,
from: data.from,
to: data.to,
Expand All @@ -133,7 +133,7 @@ export class DataModifier {
// Whatever the structure of your RemoveEvent, modify accordingly
const eventData: RoleEvent = {
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
chatId: data.chatId,
from: data.from,
to: data.to,
Expand Down Expand Up @@ -186,7 +186,7 @@ export class DataModifier {
const groupEvent: any = {
event: eventType,
origin: incomingData.messageOrigin,
timestamp: incomingData.timestamp.toString(),
timestamp: incomingData.timestamp,
chatId: incomingData.chatId,
from: incomingData.from,
meta,
Expand Down Expand Up @@ -233,7 +233,7 @@ export class DataModifier {
const messageEvent: MessageEvent = {
event: eventType,
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
chatId: data.chatId, // TODO: ChatId not working for w2w
from: data.fromCAIP10,
to: [data.toCAIP10], // TODO: Assuming 'to' is an array in MessageEvent. Update as necessary.
Expand Down Expand Up @@ -330,7 +330,7 @@ export class DataModifier {
const notificationEvent: NotificationEvent = {
event: notificationEventType,
origin: origin,
timestamp: data.epoch.toString(),
timestamp: data.epoch,
from: data.sender,
to: recipients,
notifID: data.payload_id.toString(),
Expand Down Expand Up @@ -496,7 +496,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
meta: {
Expand All @@ -515,7 +515,7 @@ export class DataModifier {
const baseEventData: BaseEventData = {
event: data.eventType,
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
spaceId: data.spaceId,
from: data.spaceCreator,
meta: {
Expand All @@ -541,7 +541,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
meta: {
Expand All @@ -560,7 +560,7 @@ export class DataModifier {
const baseEventData: BaseEventData = {
event: data.eventType,
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
spaceId: data.spaceId,
from: data.spaceCreator,
meta: {
Expand All @@ -585,7 +585,7 @@ export class DataModifier {
private static mapToRequestSpaceEvent(data: any, includeRaw: boolean): any {
const eventData: SpaceRequestEvent = {
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
spaceId: data.spaceId,
from: data.from,
to: data.to,
Expand All @@ -602,7 +602,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: any;
timestamp: number;
spaceId: any;
from: any;
to: any[];
Expand All @@ -614,7 +614,7 @@ export class DataModifier {
const baseEventData: BaseEventData = {
event: 'request',
origin: data.messageOrigin === 'other' ? 'self' : 'other',
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
spaceId: data.chatId,
from: data.fromCAIP10,
to: [data.toCAIP10],
Expand All @@ -633,7 +633,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
to: null;
Expand All @@ -645,7 +645,7 @@ export class DataModifier {
const baseEventData: BaseEventData = {
event: 'reject',
origin: data.messageOrigin === 'other' ? 'other' : 'self',
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
spaceId: data.chatId,
from: data.fromCAIP10,
to: null,
Expand All @@ -664,7 +664,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
to: null;
Expand All @@ -675,7 +675,7 @@ export class DataModifier {

const eventData: BaseEventData = {
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
spaceId: data.spaceId,
from: data.from,
to: data.to,
Expand All @@ -692,7 +692,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
to: null;
Expand All @@ -703,7 +703,7 @@ export class DataModifier {

const eventData: BaseEventData = {
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
spaceId: data.spaceId,
from: data.from,
to: data.to,
Expand All @@ -720,7 +720,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
to: null;
Expand All @@ -731,7 +731,7 @@ export class DataModifier {

const eventData: BaseEventData = {
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
spaceId: data.spaceId,
from: data.from,
to: data.to,
Expand All @@ -748,7 +748,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
to: null;
Expand All @@ -759,7 +759,7 @@ export class DataModifier {

const eventData: BaseEventData = {
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
spaceId: data.spaceId,
from: data.from,
to: null,
Expand All @@ -776,7 +776,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
to: null;
Expand All @@ -787,7 +787,7 @@ export class DataModifier {

const eventData: BaseEventData = {
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
spaceId: data.spaceId,
from: data.from,
to: null,
Expand Down Expand Up @@ -856,7 +856,7 @@ export class DataModifier {
const videoEvent: VideoEvent = {
event: videoEventType,
origin: origin,
timestamp: data.epoch.toString(),
timestamp: data.epoch,
peerInfo,
};

Expand Down
12 changes: 6 additions & 6 deletions packages/restapi/src/lib/pushstream/pushStreamTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export interface GroupEventRawData {

export interface GroupEventBase {
origin: MessageOrigin;
timestamp: string;
timestamp: number
chatId: string;
from: string;
meta: GroupMeta;
Expand All @@ -151,7 +151,7 @@ export interface UpdateGroupEvent extends GroupEventBase {
export interface GroupMemberEventBase {
event: GroupEventType | MessageEventType;
origin: MessageOrigin;
timestamp: string;
timestamp: number
chatId: string;
from: string;
to: string[];
Expand Down Expand Up @@ -185,7 +185,7 @@ export interface RoleEvent extends GroupMemberEventBase {
export interface SpaceMemberEventBase {
event: SpaceEventType | MessageEventType;
origin: MessageOrigin;
timestamp: string;
timestamp: number
spaceId: string;
from: string;
to: string[];
Expand All @@ -211,7 +211,7 @@ export interface SpaceRemoveEvent extends SpaceMemberEventBase {
export interface MessageEvent {
event: MessageEventType;
origin: MessageOrigin;
timestamp: string;
timestamp: number
chatId: string;
from: string;
to: string[];
Expand Down Expand Up @@ -239,7 +239,7 @@ export type NotificationType = keyof typeof NOTIFICATION.TYPE;
export interface NotificationEvent {
event: NotificationEventType;
origin: 'other' | 'self';
timestamp: string;
timestamp: number
from: string;
to: string[];
notifID: string;
Expand Down Expand Up @@ -298,7 +298,7 @@ export interface MessageRawData {
export interface VideoEvent {
event: VideoEventType;
origin: MessageOrigin;
timestamp: string;
timestamp: number
peerInfo: VideoPeerInfo;
raw?: GroupEventRawData;
}
Expand Down

0 comments on commit 57ceaa9

Please sign in to comment.