Coder Social home page Coder Social logo

Comments (6)

Arkady1356 avatar Arkady1356 commented on August 16, 2024 1

이것도 나쁘지 않은것 같습니다! 이대로 진행하겠습니다


사용자(참여자)의 프로필 사진도 필요로 합니다..!!


주시는김에 그냥 User관련 정보 다 주시면 감사하겠습니다~! (GET /users 처럼)
-> 그러면 Json -> 객체 생성이 더 직관적으로 가능해집니다!! (지금은 쓰레기값으로 초기화 중)


image

ㅋㅋ 좀 무섭네요 하하

from studygroup.

rbgus2002 avatar rbgus2002 commented on August 16, 2024 1

요청하신 형식으로 response 수정해서 배포했습니다 확인해주세요!

  • 프로필 이미지도 추가했습니다

from studygroup.

rbgus2002 avatar rbgus2002 commented on August 16, 2024

해당 부분 구현 완료해서 다음과 같이 response 오도록 반영했습니다.
image

from studygroup.

rbgus2002 avatar rbgus2002 commented on August 16, 2024

재우님 질문있습니다
현재는 GROUP 선배치, PERSONAL 후배치하고 각각의 task 생성 순으로 정렬해서 response 해주는 중입니다.

flutter 단에서는 어떤 식으로 GROUP과 PERSONAL을 구분해서 아래 사진과 같이 보여주는지 궁금합니다.
제가 GROUP 선배치, PERSONAL 후배치 하는 의미가 딱히 없는 걸까요?
(현재 todomate 처럼 완료처리 된 task는 맨 뒤로 보내도록 정렬 구현할까 고민 중이어서 여쭤봤습니다.)
image

from studygroup.

Arkady1356 avatar Arkady1356 commented on August 16, 2024

response시 taskType에 따른 정렬 여부는 상관없을 것 같습니다.

지금의 제 프로그램 구조를 설명드리는게 더 좋을것 같네요

// task.dart
class Task {
  int taskId;
  String detail;
  bool isDone;
}

// task_gourp.dart
class TaskGroup {
  int roundParticipantId;
  String taskType;

  List<Task> tasks;

  // add, remove, update에 관한 함수 호출하며 Tasks  관리
}

Json 데이터로 부터 객체를 만들 때에는

  1. taskType에 따라 Map 자료구조로 List를 만들고
  2. 완성된 Map을 기준으로 TaskGroup 객체를 만드는 형식을 생각해 두었습니다.

TaskGroup은 다음과 같은 모습을 가지게 됩니다
image

아래 모습은 3개의 TaskGroup이 있는 모습입니다
(각각 tasktype이 { "GROUP", "PERSONAL", "OTHER TASKTYPE" } => 새로운 taskType 추가 가능)
image


안그래도 이것을 주제로 이슈 드릴까 했었는데요,
다음과 같은 형식으로 리턴해주시면 더 좋긴합니다..! (Map을 만들 필요가 없기 때문에)
(근데 그러면 데이터베이스 형식이랑 불일치해지는 것 같길래 별도로 요청은 안드리고 제 선에서 가공해서 사용하려 했습니다)

"tasks": [
  {
    "roundParticipantId": 1,
    "statusTag": "NONE",
    "userId": 1,
    "nickName": "규규",
    "taskProgress": 0.7,
    "taskGroups": [
         {
            "taskType" : "GROUP",
            "tasks": [
                {
                   "taskId": 16,
                   "doneYn": "Y",
                   "detail": "그룹태.."
                }
                ...
            ]
         },
         {
            "TaskType" : "PERSONAL",
            "tasks": [
                {
                    ...
                }
            ]
        }
    ]
}

혹시 이 방법은 어떠신가요 하하
(taskType을 기준으로 묶어서 task들을 return)

이렇게 하면 완료된 task들에 대해서 정렬을 해도 위반되지 않고 좋을 것 같습니다 하하

이해 안되시거나 하시면 추가로 설명 드리겠습니다~

from studygroup.

rbgus2002 avatar rbgus2002 commented on August 16, 2024

혹시 이 방법은 어떠신가요 하하

약간 변형해서 다음과 같이 만들었습니다. 배포해서 반영까지 완료했는데 괜찮으신가요?

{
  "success": true,
  "statusCode": 200,
  "message": "Success",
  "data": {
    "tasks": [
      {
        "roundParticipantId": 1,
        "statusTag": "NONE",
        "userId": 1,
        "nickName": "규규",
        "taskProgress": 0.7,
        "groupTasks": [
          {
            "taskId": 20,
            "doneYn": "N",
            "taskType": "GROUP",
            "detail": "string"
          },
          {
            "taskId": 16,
            "doneYn": "Y",
            "taskType": "GROUP",
            "detail": "그룹태스크 생성 테스트22222222222"
          }
        ],
        "personalTasks": [
          {
            "taskId": 18,
            "doneYn": "N",
            "taskType": "PERSONAL",
            "detail": "string"
          },
          {
            "taskId": 19,
            "doneYn": "N",
            "taskType": "PERSONAL",
            "detail": "야호"
          },
          {
            "taskId": 22,
            "doneYn": "Y",
            "taskType": "PERSONAL",
            "detail": "test"
          }
        ]
      },
      {
        "roundParticipantId": 2,
        "statusTag": "NONE",
        "userId": 2,
        "nickName": "arkady",
        "taskProgress": 0.7,
        "groupTasks": [
          {
            "taskId": 15,
            "doneYn": "N",
            "taskType": "GROUP",
            "detail": "그룹태스크 생성 테스트"
          },
          {
            "taskId": 35,
            "doneYn": "N",
            "taskType": "GROUP",
            "detail": "엥 리턴값이 null이야"
          }
        ],
        "personalTasks": []
      }
    ]
  }
}

정렬 기준 => (완료하지 않은 task 선배치, 완료한 task 후배치) AND task 생성 기준 오름차순

모든 회차 참여자는 groupTasks와 personalTasks를 갖고 값이 없는 경우 빈 list를 반환

from studygroup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.