Skip to content

Commit

Permalink
Add limit and ofset to the gateway version3 api params
Browse files Browse the repository at this point in the history
  • Loading branch information
curvesy committed Nov 2, 2023
1 parent 8122120 commit 1a4cf83
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion services/gateway/apis/http-version3/methods/anchors.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
tags: ['Anchors'],
params: {
submitter: { optional: true, type: 'string', min: 3, max: 41, pattern: regex.ADDRESS_LISK32 },
anchorID: { optional: true, type: 'string', min: 1, max: 64, pattern: regex.HASH_SHA256 },
anchorID: { optional: true, type: 'string', min: 1, max: 64, pattern: regex.MD5 },
search: { optional: true, type: 'string' },
limit: { optional: true, type: 'number', min: 1, max: 100, default: 10 },
offset: { optional: true, type: 'number', min: 0, default: 0 },
Expand Down
6 changes: 4 additions & 2 deletions services/gateway/apis/http-version3/methods/badges.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ module.exports = {
tags: ['Badges'],
params: {
awardedTo: { optional: true, type: 'string', min: 3, max: 41, pattern: regex.ADDRESS_LISK32 },
badgeID: { optional: true, type: 'string', min: 1, max: 64, pattern: regex.HASH_SHA256 },
anchorID: { optional: true, type: 'string', min: 1, max: 64, pattern: regex.HASH_SHA256 },
badgeID: { optional: true, type: 'string', min: 1, max: 64, pattern: regex.MD5 },
anchorID: { optional: true, type: 'string', min: 1, max: 64, pattern: regex.MD5 },
type: { optional: true, type: 'string' },
limit: { optional: true, type: 'number', min: 1, max: 100, default: 10 },
offset: { optional: true, type: 'number', min: 0, default: 0 },
},
get schema() {
const badgeSchema = {};
Expand Down
2 changes: 2 additions & 0 deletions services/gateway/shared/regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const TOPIC_CSV = /^\b(?:[0-9a-fA-F]{2,64}|lsk[a-hjkm-z2-9]{38})(?:,(?:[0-9a-fA-
const HEX_STRING = /^\b[a-fA-F0-9]+\b$/;
const EXCEL_EXPORT_FILENAME = /^\btransactions_([a-fA-F0-9]{8})_(lsk[a-hjkm-z2-9]{38})_((\d{4})-((1[012])|(0?[1-9]))-(([012][1-9])|([123]0)|31))_((\d{4})-((1[012])|(0?[1-9]))-(([012][1-9])|([123]0)|31))\.xlsx\b$/;
const EVENT_NAME = /^[\w!@$&. ]{1,32}$/;
const MD5 = /^\b[a-fA-F0-9]{32}\b$/; // MD5 pattern

module.exports = {
PUBLIC_KEY,
Expand Down Expand Up @@ -95,4 +96,5 @@ module.exports = {
FEE,
EXCEL_EXPORT_FILENAME,
EVENT_NAME,
MD5,
};

0 comments on commit 1a4cf83

Please sign in to comment.