the-deep / server

Server for DEEP
https://app.thedeep.io/
GNU Affero General Public License v3.0
9 stars 3 forks source link

Implement graphql query node for assignment #1439

Closed sudan45 closed 2 days ago

sudan45 commented 5 months ago

Problem Statement

The 'Assignment' features uses a Rest API.

Acceptance Criteria

The 'Assignment' feature works with a graphql query.

Additional Information

serializers

https://github.com/the-deep/server/blob/bbfdef24fa80f04a046cca7f957297adc534ba15/apps/notification/serializers.py#L72-L93

views

https://github.com/the-deep/server/blob/bbfdef24fa80f04a046cca7f957297adc534ba15/apps/notification/views.py#L80-L103

testcases

https://github.com/the-deep/server/blob/bbfdef24fa80f04a046cca7f957297adc534ba15/apps/notification/tests/test_apis.py#L235-L266 Rest Framework urls

method: GET
url: /api/v1/assignments/
request params : ?is_done=3&offset=0&limit=5
response: [
        {
            "id": ID,
            "createdAt": Datetime,
            "projectDetails": ProjectDetails
            "createdByDetails": UserDetails
            "contentObjectDetails": ContentDetails(ie lead, entry details)
            "contentType": ID,
            "isDone": Boolean,
            "contentObjectType": str
        }
]

Expected graphql

enum AssignmentContentTypeEnum {
  LEAD
  ENTRY_REVIEW_COMMENT
}

type AssignmentContentDataType {
  contentType: AssignmentContentTypeEnum
  lead: AssignmentLeadDetailType
  entryReviewComment: AssignmentEntryReviewCommentDetailType
}

input AssignmentInputType {
  isDone: Boolean
}

type AssignmentLeadDetailType {
  id: ID!
  title: String!
}

type AssignmentProjectDetailType {
  id: ID!
  title: String!
}

type AssignmentType {
  id: ID!
  createdAt: DateTime!
  createdBy: UserType
  createdFor: UserType!
  project: AssignmentProjectDetailType
  isDone: Boolean!
  objectId: Int!
  contentData: AssignmentContentDataType
}

type AssignmentListType {
  results: [AssignmentType!]
  totalCount: Int
  page: Int
  pageSize: Int
}

type AssignmentUpdate {
  errors: [GenericScalar!]
  ok: Boolean
  result: AssignmentType
}
sudan45 commented 5 months ago

@puranban @AdityaKhatri @subinasr Note: The client needs to review the lead and entry content types. If contenttype is lead, map data with LeadType; if not, map with EntryType.