From 5f5f15a990491cbd00929f05e22a1ae9389c64ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hector=20G=C3=B3mez=20Varela?= <hector@safe.global>
Date: Fri, 26 Jul 2024 11:46:31 +0200
Subject: [PATCH] Add DB_MAX_SAFE_INTEGER constant

---
 src/domain/accounts/entities/__tests__/account.builder.ts | 5 +++--
 src/domain/common/constants.ts                            | 5 +++++
 2 files changed, 8 insertions(+), 2 deletions(-)
 create mode 100644 src/domain/common/constants.ts

diff --git a/src/domain/accounts/entities/__tests__/account.builder.ts b/src/domain/accounts/entities/__tests__/account.builder.ts
index 29ff1dd6db..8f563c60ab 100644
--- a/src/domain/accounts/entities/__tests__/account.builder.ts
+++ b/src/domain/accounts/entities/__tests__/account.builder.ts
@@ -1,12 +1,13 @@
 import { Builder, IBuilder } from '@/__tests__/builder';
 import { Account } from '@/domain/accounts/entities/account.entity';
+import { DB_MAX_SAFE_INTEGER } from '@/domain/common/constants';
 import { faker } from '@faker-js/faker';
 import { getAddress } from 'viem';
 
 export function accountBuilder(): IBuilder<Account> {
   return new Builder<Account>()
-    .with('id', faker.number.int({ max: 1_000_000 }))
-    .with('group_id', faker.number.int({ max: 1_000_000 }))
+    .with('id', faker.number.int({ max: DB_MAX_SAFE_INTEGER }))
+    .with('group_id', faker.number.int({ max: DB_MAX_SAFE_INTEGER }))
     .with('address', getAddress(faker.finance.ethereumAddress()))
     .with('created_at', faker.date.recent())
     .with('updated_at', faker.date.recent());
diff --git a/src/domain/common/constants.ts b/src/domain/common/constants.ts
new file mode 100644
index 0000000000..1380250e95
--- /dev/null
+++ b/src/domain/common/constants.ts
@@ -0,0 +1,5 @@
+/**
+ * The maximum safe integer for the database.
+ * This is the maximum value that can be stored in the database for an integer column.
+ */
+export const DB_MAX_SAFE_INTEGER = Math.pow(2, 31) - 1;