Soojeong Lee

2025. 7. 5.

Soojeong Lee

2025. 7. 5.

Soojeong Lee

2025. 7. 5.

모델링 잡아보기

모델링 잡아보기

객체 차원에서 고민해보기

일단 가볍게 떠올려봤다.

우선, 해당 서비스에 들어가는 객체를 생각해보자.

  • 사용자 (계정주)

  • 돌아간 사람

    • 사망 일자

    • 추모지 위치

    • 사진들

    • 영상들

    • 메모들


각 사진, 영상 객체에도 추가 정보가 들어간다.

  • 사진/영상

    • 메모

    • 위치

    • 생성 시점


서비스에 필요한 정보 기준으로 클래스를 만들어보았다.

import 'media_item.model.dart';
import 'note.model.dart';

class LostPerson {
  final DateTime dateOfDeath;
  final String memorialLocation;
  final List<MediaItem> photos;
  final List<MediaItem> videos;
  final List<Note> notes;

  LostPerson({
    required this.dateOfDeath,
    required this.memorialLocation,
    List<MediaItem>? photos,
    List<MediaItem>? videos,
    List<Note>


메모는 Note 클래스로 만들었다.

class Note {
  final String content;
  final String location;
  final DateTime createdAt;

  Note({
    required this.content,
    required this.location,
    required this.createdAt,
  });
}


사진/영상은 묶어서 MediaItem이라는 클래스로 만들었다.

class MediaItem {
  final String url;
  final String note;
  final String location;
  final DateTime createdAt;

  MediaItem({
    required this.url,
    required this.note,
    required this.location,
    required this.createdAt,
  });
}


요래요래 모델링의 시작이다.

Comments

Comments

Comments