improvement: QRcode and shared link added to cases inorder to make it possible for staff users to share a case info with other staffs or other clinics.
This commit is contained in:
@@ -42,6 +42,7 @@ export const ErrorCode = {
|
||||
PERMISSION_ACCESS_STAFF: 'PERMISSION_ACCESS_STAFF',
|
||||
PERMISSION_EDIT_STAFF: 'PERMISSION_EDIT_STAFF',
|
||||
PERMISSION_ORG_NOT_FOUND: 'PERMISSION_ORG_NOT_FOUND',
|
||||
LAB_CASE_ACCESS_DENIED: 'LAB_CASE_ACCESS_DENIED',
|
||||
|
||||
// Validation
|
||||
VALIDATION_FAILED: 'VALIDATION_FAILED',
|
||||
|
||||
11
backend/src/common/lab-case-access-token.ts
Normal file
11
backend/src/common/lab-case-access-token.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { randomBytes } from 'crypto';
|
||||
|
||||
export function generateLabCaseAccessToken(): string {
|
||||
return randomBytes(32).toString('base64url');
|
||||
}
|
||||
|
||||
export function buildLabCaseShareUrl(accessToken: string, locale = 'en'): string {
|
||||
const appUrl = (process.env.FRONTEND_URL || 'http://localhost:3001').replace(/\/$/, '');
|
||||
const normalizedLocale = locale.trim() || 'en';
|
||||
return `${appUrl}/${normalizedLocale}/lab-case/${accessToken}`;
|
||||
}
|
||||
Reference in New Issue
Block a user