Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
a89e5f8
Update shema add the new attribute in model license table to suspend…
vthish Jun 21, 2026
e2bee3c
Merge pull request #68 from vthish/backend-refactor-new
vthish Jun 21, 2026
348ca5c
Add the auto_ledger app
vthish Jun 21, 2026
1017f42
Fix the merge and add the git workin app codes
vthish Jun 21, 2026
7c78d43
Merge pull request #69 from vthish/feature/driver-app-ui-pages
vthish Jun 21, 2026
aef7c4f
Update fines.service.ts
vthish Jun 21, 2026
0a1851f
Update home sscreen ui
vthish Jun 21, 2026
41350e8
Refactor temporary license handling in fines service
vthish Jun 22, 2026
43d3aa0
Glassy look ui in home screen
vthish Jun 22, 2026
bb05bea
Update the home screen ui new look
vthish Jun 22, 2026
c1c47b0
Add new get endpoint for view fine history to traffic officer
vthish Jun 22, 2026
9c98b1b
Add newe endpoint for license
vthish Jun 22, 2026
bfd38f3
Update ui
vthish Jun 22, 2026
b566e25
Change the points logic
vthish Jun 22, 2026
9f9050e
Home screen is fully connectted to backend
vthish Jun 22, 2026
bd67e42
uodate the backend code for escape the conflict
vthish Jun 22, 2026
bcc89ec
Update the auth servis
vthish Jun 23, 2026
824d05e
Change device access error to OTP verification requirement
vthish Jun 23, 2026
1636e1d
Update the login screen and register screen ui
vthish Jun 23, 2026
98ec053
Optimized ui
vthish Jun 23, 2026
161cdb2
Login and Register screen new updates
vthish Jun 23, 2026
3b14616
Fix toast msg position
vthish Jun 23, 2026
20520a1
Merge branch 'development' of https://github.com/vthish/Auto-Ledger i…
vthish Jun 23, 2026
ddf421e
Add the fine screen and update home screen
vthish Jun 23, 2026
ea93481
Update the fine screen's payment ui
vthish Jun 23, 2026
4b35443
Update the fines payment ui
vthish Jun 23, 2026
4a56d6a
Add the app icon
vthish Jun 23, 2026
8b4d6db
Fines screen connected to backend
vthish Jun 23, 2026
c74065d
Add the profile screen but not cmpleted yet
vthish Jun 24, 2026
336a460
Change the ui/ux design light to dark
vthish Jun 24, 2026
d6368be
Fix qr scanning problem
vthish Jun 24, 2026
1d89bcb
Refactor the app package name and update the firebase details
vthish Jun 26, 2026
7cbb3b3
Update the screens
vthish Jun 26, 2026
dab1181
Update the forgot password pop up dialog screen fields
vthish Jun 26, 2026
9c06eb5
Refactor user identification in password change methods
vthish Jun 26, 2026
e2dc1b1
Merge branch 'development' of https://github.com/vthish/Auto-Ledger i…
vthish Jun 26, 2026
3f9620b
Update the profile screen code for fix the reset password function
vthish Jun 26, 2026
5a17b07
Add the biometrick unlock for the app but these codes are include the…
vthish Jun 26, 2026
d53880c
Update the code removing debug code
vthish Jun 26, 2026
c971833
Fix biometric login error
vthish Jun 26, 2026
23ae628
Delete frontend_apps/auto_ledger_police directory
vthish Jun 26, 2026
ae36b29
Delete frontend_apps/auto_ledger_police directory
vthish Jun 26, 2026
1d6cf71
Add password verification before enabling biometric login in profile …
vthish Jun 26, 2026
c103467
Update some bugs in register screen code
vthish Jun 26, 2026
9134bbb
Merge branch 'feature/driver-app-ui-pages' of https://github.com/vthi…
vthish Jun 26, 2026
b2f499d
Increase the opacity in Virtual license card
vthish Jun 26, 2026
767f305
Animate loading dots continuously
vthish Jun 26, 2026
83c256c
Update the fine card design
vthish Jun 26, 2026
45c7250
Add points history tab and PDF receipt download
vthish Jun 26, 2026
8e06d44
Completed app
vthish Jun 26, 2026
33a93e5
Create release apk
vthish Jun 26, 2026
6427d73
Autp-Ledger(Driver) Completed App and release build
vthish Jun 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions backend/nest-api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ enum Fine_Status {
PENDING
PAID
OVERDUE
COURT_CASE
}

enum Payment_Status {
Expand All @@ -35,11 +36,13 @@ model QR_Scan_History {
scan_Id String @id @default(uuid())
qr_Token String
scan_Time DateTime @default(now())
traffic_Officer_Id String
traffic_Officer_Name String
driver_Name String
location String?
license_Id String
license Driving_License @relation(fields: [license_Id], references: [license_Id])
officer Traffic_Officer @relation(fields: [traffic_Officer_Id], references: [traffic_Officer_Id])
}

model DMT_Admin {
Expand Down Expand Up @@ -77,11 +80,12 @@ model Driving_License {
nic_No String @unique
status License_Status @default(ACTIVE)
image String?
points Int @default(24)
points Int @default(0)
suspended_Until DateTime?
address String
date_of_birth DateTime
blood_Group String
issue_Date DateTime
issue_Date DateTime
user_Id String @unique
user User @relation(fields: [user_Id], references: [user_Id])
dmt_Admin_Id String
Expand All @@ -94,10 +98,10 @@ model Driving_License {

model License_Vehicle_Category {
category_Id String @id @default(uuid())
vehicle_Class String
vehicle_Class String
issue_Date DateTime
expiry_Date DateTime
restriction String?
restriction String?
license_Id String
license Driving_License @relation(fields: [license_Id], references: [license_Id], onDelete: Cascade)
}
Expand All @@ -108,6 +112,8 @@ model Temporary_License {
expiry_Date DateTime
license_Id String
license Driving_License @relation(fields: [license_Id], references: [license_Id])
issued_By String
officer Traffic_Officer @relation(fields: [issued_By], references: [traffic_Officer_Id])
}

model Division {
Expand All @@ -134,18 +140,20 @@ model Divisional_Head {
}

model Traffic_Officer {
traffic_Officer_Id String @id @default(uuid())
badge_No String @unique
email String @unique
traffic_Officer_Id String @id @default(uuid())
badge_No String @unique
email String @unique
name String
role Officer_Role @default(TRAFFIC_OFFICER)
role Officer_Role @default(TRAFFIC_OFFICER)
password String
reset_Otp String?
reset_Otp_Expires_At DateTime?
divisional_Head_Id String
divisionalHead Divisional_Head @relation(fields: [divisional_Head_Id], references: [divisional_Head_Id])
divisionalHead Divisional_Head @relation(fields: [divisional_Head_Id], references: [divisional_Head_Id])
shifts Shift[]
fines Fine[]
qrScans QR_Scan_History[]
temporaryLicenses Temporary_License[]
}

model Shift {
Expand Down Expand Up @@ -191,6 +199,7 @@ model Fine_Offence {
offense_Id String
fine Fine @relation(fields: [fine_Id], references: [fine_Id])
offenceCategory Offence_Category @relation(fields: [offense_Id], references: [offense_Id])

@@id([fine_Id, offense_Id])
}

Expand Down
5 changes: 2 additions & 3 deletions backend/nest-api/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ export class OfficerResetPasswordDto {
export interface AuthRequest {
user: {
id: string;
sub: string;
role: string;
};
}
Expand Down Expand Up @@ -393,7 +392,7 @@ export class AuthController {
@Body() changePasswordDto: ChangePasswordDto,
) {
return this.authService.changePassword(
req.user.sub,
req.user.id,
req.user.role,
changePasswordDto,
);
Expand All @@ -407,6 +406,6 @@ export class AuthController {
@Request() req: AuthRequest,
@Body() changePasswordDto: ChangePasswordDto,
) {
return this.authService.changeUserPassword(req.user.sub, changePasswordDto);
return this.authService.changeUserPassword(req.user.id, changePasswordDto);
}
}
9 changes: 6 additions & 3 deletions backend/nest-api/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,12 @@ export class AuthService {
throw new UnauthorizedException('Invalid NIC or password.');

if (user.device_Id !== deviceId) {
throw new UnauthorizedException(
'Access Denied: You can only log in from your registered device.',
);
// Return specific error structure for new device matching
throw new ForbiddenException({
code: 'DEVICE_MISMATCH',
message: 'New device detected. OTP verification required.',
phone: user.mobile_Phone_No,
});
}

return this.generateUserToken(user);
Expand Down
18 changes: 16 additions & 2 deletions backend/nest-api/src/fines/fines.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,30 @@ export class FinesController {
@Post()
issueFine(
@Request() req: AuthRequest,
@Body() body: { licenseId: string; offenseIds: string[]; comment?: string },
@Body() body: { scanToken: string; offenseIds: string[]; comment?: string },
) {
return this.finesService.issueFine({
licenseId: body.licenseId,
scanToken: body.scanToken,
officerId: req.user.id,
offenseIds: body.offenseIds,
comment: body.comment,
});
}

@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('TRAFFIC_OFFICER')
@Get('officer-stats')
getTrafficOfficerStats(@Request() req: AuthRequest) {
return this.finesService.getTrafficOfficerStats(req.user.id);
}

@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('TRAFFIC_OFFICER')
@Get('officer-fines')
async getOfficerFines(@Request() req: AuthRequest) {
return this.finesService.getOfficerFines(req.user.id);
}

@UseGuards(JwtAuthGuard)
@Get('my-fines')
getMyFines(@Request() req: AuthRequest) {
Expand Down
8 changes: 7 additions & 1 deletion backend/nest-api/src/fines/fines.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ import { Module } from '@nestjs/common';
import { FinesService } from './fines.service';
import { FinesController } from './fines.controller';
import { PrismaModule } from '../prisma/prisma.module';
import { JwtModule } from '@nestjs/jwt';

@Module({
imports: [PrismaModule],
imports: [
PrismaModule,
JwtModule.register({
secret: process.env.JWT_SECRET || 'defaultSecretKey',
}),
],
controllers: [FinesController],
providers: [FinesService],
exports: [FinesService],
Expand Down
Loading
Loading