Skip to content

Commit

Permalink
Change: fix string to number
Browse files Browse the repository at this point in the history
  • Loading branch information
Voktor Stolenets committed Jan 23, 2025
1 parent 73eca22 commit 2045bbf
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ async function getMessages(request: FastifyRequest, reply: FastifyReply) {
skip?: number;
limit?: number;
};

skip = +skip;
limit = +limit;
tokenAddress = tokenAddress.toLowerCase();
const messages = await request.server.mongo.db
?.collection("message")
Expand Down Expand Up @@ -331,6 +334,8 @@ async function getMessagesByUser(request: FastifyRequest, reply: FastifyReply) {
skip?: number;
limit?: number;
};
skip = +skip;
limit = +limit;
address = address.toLowerCase();
const messages = await request.server.mongo.db
?.collection("message")
Expand Down Expand Up @@ -358,6 +363,8 @@ async function getMessageReplies(request: FastifyRequest, reply: FastifyReply) {
skip?: number;
limit?: number;
};
skip = +skip;
limit = +limit;
const messages = await request.server.mongo.db
?.collection("message")
.find({ id })
Expand Down Expand Up @@ -396,11 +403,12 @@ async function getToken(request: FastifyRequest, reply: FastifyReply) {
async function getUserLikes(request: FastifyRequest, reply: FastifyReply) {
try {
let { address } = request.headers as { address?: string };
const { skip, limit } = request.query as {
let { skip, limit } = request.query as {
skip?: number;
limit?: number;
};

skip = +skip;
limit = +limit;
address = address.toLowerCase();
const likes = await request.server.mongo.db
?.collection("like")
Expand Down Expand Up @@ -518,6 +526,8 @@ async function getFollowers(request: FastifyRequest, reply: FastifyReply) {
skip?: number;
limit?: number;
};
skip = +skip;
limit = +limit;
userAddress = userAddress.toLowerCase();
const followers = await request.server.mongo.db
?.collection("followers")
Expand Down Expand Up @@ -545,6 +555,8 @@ async function getFollowed(request: FastifyRequest, reply: FastifyReply) {
skip?: number;
limit?: number;
};
skip = +skip;
limit = +limit;
address = address.toLowerCase();

const followerd = await request.server.mongo.db
Expand Down

0 comments on commit 2045bbf

Please sign in to comment.