feat: add user submission history preparations

This commit is contained in:
2026-09-08 17:44:47 +03:30
parent f90b802419
commit f0bf186b6c
15 changed files with 82 additions and 82 deletions
+21
View File
@@ -7,3 +7,24 @@ export const normalizePhone = (phone: string): string => {
return phone;
};
type GenerateCodeOptions = {
prefix?: string;
length?: number;
};
export const generateCode = (options?: GenerateCodeOptions) => {
const prefix = options?.prefix || '';
const length = options?.length || 5;
const characters =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let random = '';
for (let i = 0; i < length; i++) {
random += characters.charAt(Math.floor(Math.random() * characters.length));
}
return `${prefix}${random}`;
};