Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
add create-card feature
Browse files Browse the repository at this point in the history
  • Loading branch information
NFriedo committed Mar 5, 2024
1 parent 724f980 commit 98a0720
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/socket/socket/socket.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,17 @@ export class SocketGateway
client.broadcast.emit('delete-card-success', data);
client.emit('delete-card-success', data);
}

@SubscribeMessage('create-card-request')
handleCreateCard(client: any, data: any) {
this.logger.log(`Message received from client id: ${client.id}`);
this.logger.debug(`Payload: ${JSON.stringify(data)}`);

const cardId = `card${Math.floor(Math.random() * 1000)}`;
const responsePayload = { ...data, cardId, text: '' };
this.logger.debug(`Response Payload: ${JSON.stringify(responsePayload)}`);

client.broadcast.emit('create-card-success', responsePayload);
client.emit('create-card-success', responsePayload);
}
}

0 comments on commit 98a0720

Please sign in to comment.