feat: category

This commit is contained in:
efrilm
2025-08-17 12:50:10 +07:00
parent f84090c0e6
commit 4a4f6388d7
19 changed files with 2041 additions and 20 deletions
@@ -0,0 +1,31 @@
part of '../category_dtos.dart';
@freezed
class CategoryDto with _$CategoryDto {
const CategoryDto._();
const factory CategoryDto({
@JsonKey(name: 'id') String? id,
@JsonKey(name: 'organization_id') String? organizationId,
@JsonKey(name: 'name') String? name,
@JsonKey(name: 'description') String? description,
@JsonKey(name: 'business_type') String? businessType,
@JsonKey(name: 'metadata') Map<String, dynamic>? metadata,
@JsonKey(name: 'created_at') DateTime? createdAt,
@JsonKey(name: 'updated_at') DateTime? updatedAt,
}) = _CategoryDto;
factory CategoryDto.fromJson(Map<String, dynamic> json) =>
_$CategoryDtoFromJson(json);
Category toDomain() => Category(
id: id ?? '',
organizationId: organizationId ?? '',
name: name ?? '',
description: description ?? '',
businessType: businessType ?? '',
metadata: metadata ?? {},
createdAt: createdAt,
updatedAt: updatedAt,
);
}