My Parse Server API Request is returning empty {} - axios

i use Back4app that uses Parse Server and node.js (axios module), to implement calls for API-football. I am getting a 200 sucess response code, running the template code as below, but it is always returning an empty {} response (Insomnia).
Thanks in advance for any help.
Parse.Cloud.define("next50", (request)=>{
const axios = require("axios");
const options = {
method: 'GET',
url: 'https://api-football-v1.p.rapidapi.com/v3/fixtures',
params: {next:'50'},
headers: {
'X-RapidAPI-Key': 'd69302225emshdf770c890926efdp19ca04jsn08d2244e2253',
'X-RapidAPI-Host': 'api-football-v1.p.rapidapi.com',
}
};
axios.request(options).then( function (response) {
return response.data;
}).catch(function (error) {
return error;
});
});

I read axios documentation carefully and implemented a code that works, returning the correct JSON response.
here it is:
Parse.Cloud.define("next50", (request)=>{
const axios = require("axios");
const options = {
method: 'GET',
url: 'https://api-football-v1.p.rapidapi.com/v3/fixtures',
params: {next:'50'},
headers: {
'X-RapidAPI-Key': 'd69302225emshdf770c890926efdp19ca04jsn08d2244e2253',
'X-RapidAPI-Host': 'api-football-v1.p.rapidapi.com',
}
};
var result = axios.request(options).then( function (response) {
return (response.data);
}).catch(function (error) {
return(error);
});
return (result);//👍✔
});
here is the response:
{
"result": {
"get": "fixtures",
"parameters": {
"next": "50"
},
"errors": [],
"results": 50,
"paging": {
"current": 1,
"total": 1
},
"response": [
{
"fixture": {
"id": 841439,
"referee": null,
"timezone": "UTC",
"date": "2022-11-06T11:00:00+00:00",
"timestamp": 1667732400,
"periods": {
"first": null,
"second": null
},
"venue": {
"id": 7699,
"name": "Salaspils sporta nama stadions",
"city": "Salaspils"
},
"status": {
"long": "Not Started",
"short": "NS",
"elapsed": null
}
},
"league": {
"id": 365,
"name": "Virsliga",
"country": "Latvia",
"logo": "https://media.api-sports.io/football/leagues/365.png",
"flag": "https://media.api-sports.io/flags/lv.svg",
"season": 2022,
"round": "Regular Season - 35"
},
"teams": {
"home": {
"id": 4143,
"name": "Super Nova",
"logo": "https://media.api-sports.io/football/teams/4143.png",
"winner": null
},
"away": {
"id": 4153,
"name": "Valmiera / BSS",
"logo": "https://media.api-sports.io/football/teams/4153.png",
"winner": null
}
},
"goals": {
"home": null,
"away": null
},
"score": {
"halftime": {
"home": null,
"away": null
},
"fulltime": {
"home": null,
"away": null
},
"extratime": {
"home": null,
"away": null
},
"penalty": {
"home": null,
"away": null
}
}
},
{
"fixture": {
"id": 841440,
"referee": null,
"timezone": "UTC",
"date": "2022-11-06T11:00:00+00:00",
"timestamp": 1667732400,
"periods": {
"first": null,
"second": null
},
"venue": {
"id": null,
"name": "LNK Sporta Parks",
"city": "Riga"
},
"status": {
"long": "Not Started",
"short": "NS",
"elapsed": null
}
},
"league": {
"id": 365,
"name": "Virsliga",
"country": "Latvia",
"logo": "https://media.api-sports.io/football/leagues/365.png",
"flag": "https://media.api-sports.io/flags/lv.svg",
"season": 2022,
"round": "Regular Season - 35"
},
"teams": {
"home": {
"id": 4160,
"name": "Rīgas FS",
"logo": "https://media.api-sports.io/football/teams/4160.png",
"winner": null
},
"away": {
"id": 661,
"name": "FK Liepaja",
"logo": "https://media.api-sports.io/football/teams/661.png",
"winner": null
}
},
"goals": {
"home": null,
"away": null
},
"score": {
"halftime": {
"home": null,
"away": null
},
"fulltime": {
"home": null,
"away": null
},
"extratime": {
"home": null,
"away": null
},
"penalty": {
"home": null,
"away": null
}
}
},
{
best regards for all.

Related

Adding Node to exisitng documents mongodb

I am trying to update the existing document with one extra field as a new requirement in DB needs that
Existing field
[{
"_id": {
"$oid": "62a8ad644035e93c7ff24607"
},
"user_name": "demo2#devia.com",
"password": "1234",
"college_id": {
"$oid": "628dfd41ef796e8f757a5c13"
},
"basic_details": {
"first_name": "ghgh",
"middle_name": "",
"last_name": "gh",
"email": "demo2#devia.com",
"mobile_number": 1234567890
},
"address_details": {
"country": {
"country_id": {
"$oid": "623012f9683f8fb7bd213c36"
},
"country_code": "IN"
},
"state": {
"state_id": {
"$oid": "623013d9683f8fb7bd2381c4"
},
"state_code": "MP"
},
"city": {
"city_id": {
"$oid": "6230139f683f8fb7bd21f1a9"
},
"city_name": "Akodia"
},
"address_line1": "",
"address_line2": "",
"pincode": ""
},
"is_verify": false,
"last_accessed": {
"$date": {
"$numberLong": "1655221604144"
}
},
"created_at": {
"$date": {
"$numberLong": "1655221604144"
}
},
"course_details": {}
}]
Needs to update all fields
[{
"_id": {
"$oid": "62bf2cf2a8c782741bbcc398"
},
"user_name": "a#exaple.com",
"password": "$2b$12$NgLNYm5jUBmFUq.w15.qCO35GiTJX09jAnOpoGuPt9G7GNuOkVN7K",
"college_id": {
"$oid": "628dfd41ef796e8f757a5c13"
},
"basic_details": {
"email": "a#example.com",
"mobile_number": "9898989898",
"first_name": "Fahim",
"middle_name": "",
"last_name": "Ashhab",
"nationality": "Antiguans",
"date_of_birth": "2003-02-04",
"admission_year": "2022-23",
"gender": "Male",
"category": "General",
"para_ability": {
"is_disable": false,
"name_of_disability": ""
}
},
"address_details": {
"communication_address": {
"country": {
"country_id": {
"$oid": "623012f9683f8fb7bd213c36"
},
"country_code": "IN"
},
"state": {
"state_id": {
"$oid": "623013d9683f8fb7bd2380ef"
},
"state_code": "AP"
},
"city": {
"city_id": {
"$oid": "6230139f683f8fb7bd21ebc8"
},
"city_name": "Akasahebpet"
},
"address_line1": "jjkjk",
"address_line2": "uiui",
"pincode": "989898"
}
},
"is_verify": true,
"last_accessed": {
"$date": {
"$numberLong": "1656696050670"
}
},
"created_at": {
"$date": {
"$numberLong": "1656696050670"
}
},
"allocate_to_counselor": {
"counselor_id": {
"$oid": "62bfd13a5ce8a398ad101bd7"
},
"counselor_name": "test",
"last_update": {
"$date": {
"$numberLong": "1656817948401"
}
}
},
"course_details": {
"BSc": {
"course_id": {
"$oid": "628e03d94e22276b98231407"
},
"course_name": "BSc",
"application_id": {
"$oid": "62bf2cf2a8c782741bbcc399"
},
"status": "Incomplete",
"specs": [
{
"spec_name": "Physician Assistant",
"is_activated": true
}
]
}
}
}]
Query Tried nothing is happening
db.collection.aggregate([
{$match:{"address_details.country": {$exists:true}}},
{$set:{address_details:{communication_address:"$address_details"}}}
])
2nd Query Tried didn't go through
db.studentsPrimaryDetails.updateMany({
"address_details.communication_address": {"$exist":false}},
{$set: {"address_details.communication_address":"$address_details"}})
The desired result needs to be
from this
"address_details": {
"country": {
"country_id": {
"$oid": "623012f9683f8fb7bd213c36"
},
"country_code": "IN"
},
"state": {
"state_id": {
"$oid": "623013d9683f8fb7bd2381c4"
},
"state_code": "MP"
},
"city": {
"city_id": {
"$oid": "6230139f683f8fb7bd21f1a9"
},
"city_name": "Akodia"
},
"address_line1": "",
"address_line2": "",
"pincode": ""
}
to this
"address_details": {
"communication_address": {
"country": {
"country_id": {
"$oid": "623012f9683f8fb7bd213c36"
},
"country_code": "IN"
},
"state": {
"state_id": {
"$oid": "623013d9683f8fb7bd2380ef"
},
"state_code": "AP"
},
"city": {
"city_id": {
"$oid": "6230139f683f8fb7bd21ebc8"
},
"city_name": "Akasahebpet"
},
"address_line1": "jjkjk",
"address_line2": "uiui",
"pincode": "989898"
}
}
Don't know what I am doing wrong.
Edit :
Desired full output
[{
"_id": {
"$oid": "62bf2cf2a8c782741bbcc398"
},
"user_name": "a#example.com",
"password": "12345678",
"college_id": {
"$oid": "628dfd41ef796e8f757a5c13"
},
"basic_details": {
"email": "a#example.com",
"mobile_number": "9898989898",
"first_name": "Fahim",
"middle_name": "",
"last_name": "Ashhab",
"nationality": "Antiguans",
"date_of_birth": "2003-02-04",
"admission_year": "2022-23",
"gender": "Male",
"category": "General",
"para_ability": {
"is_disable": false,
"name_of_disability": ""
}
},
"address_details": {
"communication_address": {
"country": {
"country_id": {
"$oid": "623012f9683f8fb7bd213c36"
},
"country_code": "IN"
},
"state": {
"state_id": {
"$oid": "623013d9683f8fb7bd2380ef"
},
"state_code": "AP"
},
"city": {
"city_id": {
"$oid": "6230139f683f8fb7bd21ebc8"
},
"city_name": "Akasahebpet"
},
"address_line1": "jjkjk",
"address_line2": "uiui",
"pincode": "989898"
}
},
"is_verify": true,
"last_accessed": {
"$date": {
"$numberLong": "1656696050670"
}
},
"created_at": {
"$date": {
"$numberLong": "1656696050670"
}
},
"allocate_to_counselor": {
"counselor_id": {
"$oid": "62bfd13a5ce8a398ad101bd7"
},
"counselor_name": "viru chaudhary",
"last_update": {
"$date": {
"$numberLong": "1656817948401"
}
}
},
"course_details": {
"BSc": {
"course_id": {
"$oid": "628e03d94e22276b98231407"
},
"course_name": "BSc",
"application_id": {
"$oid": "62bf2cf2a8c782741bbcc399"
},
"status": "Incomplete",
"specs": [
{
"spec_name": "Physician Assistant",
"is_activated": true
}
]
}
}
}]```
One option is:
Use $exists instead of $exist
Use pipeline in order to be able to $set the value from another fields' value
db.collection.updateMany(
{"address_details.communication_address": {$exists: false}},
[{$set: {address_detailsB: {communication_address: "$address_details"}}},
{$set: {
address_details: "$address_detailsB",
address_detailsB: "$$REMOVE"}
}
])
See how it works on the playground example
The aggregation query that you first tried, does not not update the db, it only returns data. In order to use it as an updater you need to add a $merge step.

Why does my mockito failed test when actual result same as the expected result? flutter

I'm using Mockito in flutter application and want to add some test cases:
this run failed while the actual result is the same as expected result, here's my test file:
#GenerateMocks([ResumeParserDataSource])
void main() {
late MockResumeParserDataSource resumeParserDataSource;
late ResumeParserController resumeParserController;
late ResumeParserRepo resumeParserRepo;
setUp(() async {
Get.reset();
resumeParserDataSource = MockResumeParserDataSource();
resumeParserRepo =
Get.put(ResumeParserRepo(dataSource: resumeParserDataSource));
resumeParserController = Get.put(ResumeParserController());
});
group('Upload resume that uploaded into API:\n', () {
test(
'~succeed state~ api get response and parsed it into model JSON "ParsedDetailsResume"',
() async {
when(resumeParserRepo
.getResumeDetailsAfterParsing(ResumeParserTestUtil.fileName))
.thenAnswer((_) async => Right(
ResumeParserTestUtil.parsedResumeDetailsFunction(
ResumeParserTestUtil.parsedResumeDetailsModel1)));
await resumeParserController
.parseResumeToAPI(ResumeParserTestUtil.fileName);
await waitForAPIResponse();
expect(
resumeParserController.parsedResume.value,
some(ResumeParserTestUtil.parsedResumeDetailsFunction(
ResumeParserTestUtil.parsedResumeDetailsModel1)));
expect(resumeParserController.error.value, none());
});
});
}
here's my ResumeParserController:
class ResumeParserController extends GetxController {
static ResumeParserController get to => Get.find();
final resumeParserRepo = ResumeParserRepo.to;
Rx<Option<ParsedResumeDetails>> parsedResume =
Rx<Option<ParsedResumeDetails>>(none());
Future<Either<DioError, ParsedResumeDetails>> parseResumeToAPI(
String fileName,
{User? user}) async {
var result = await resumeParserRepo.getResumeDetailsAfterParsing(
fileName,
user: user,
);
return result.fold(
(l) => Left(l),
(newParsedResume) async {
error.value = none();
parsedResume.value = some(newParsedResume);
update();
return Right(newParsedResume);
},
);
}
}
and here's my json model in ResumeParserTestUtil:
class ResumeParserTestUtil {
static String fileName = "12989801ahsduiabsdui9123ajd.pdf";
static ParsedResumeDetails parsedResumeDetailsFunction(
Map<String, dynamic> response,
{User? user}) {
var userSkills = response['data']['userSkills'] == null
? [PublicUserSkill.empty()]
: List.from(response['data']['userSkills'])
.map((e) => PublicUserSkill.fromJson(e["skill"]))
.toList();
var userEducations = response['data']['educations'] == null
? [EducationParsed.empty()]
: List.from(response['data']['educations'])
.map((e) => EducationParsed.fromJson(e))
.toList();
var experiences = response['data']['experiences'] == null
? [ExperiencesParsed.empty()]
: List.from(response['data']['experiences'])
.map((e) => ExperiencesParsed.fromJson(e))
.toList();
return ParsedResumeDetails(
user: user,
userSkills:
userSkills.map(mapPublicUserSkillToSkillWithUserSkill).toList(),
userEducation: userEducations,
userWorkExperience: experiences,
);
}
static Map<String, dynamic> parsedResumeDetailsModel1 = {
"data": {
"experiences": [
{
"startDate": null,
"endDate": null,
"isPresent": false,
"organization": "Unnamed company",
"type": "WORK"
}
],
"userSkills": [
{
"skill": {
"id": "7963a547-3980-47d6-8ffc-c9e311152d9b",
"name": "Bachelors Degree > Bachelors Degree Economics",
"popularity": "0",
"flagRecount": false,
"createdAt": null,
"updatedAt": null,
},
},
{
"skill": {
"id": "05516ee5-1706-4296-aaa3-f3386767dec6",
"name":
"Bachelors Degree > Bachelors Degree Information Engineering and Media",
"popularity": "0",
"flagRecount": false,
"createdAt": null,
"updatedAt": null,
}
},
{
"skill": {
"id": "0baaa115-a770-42f5-ad54-291ffa42a11c",
"name": "Bachelors Degree > Bachelors Degree Literature",
"popularity": "0",
"flagRecount": false,
"createdAt": null,
"updatedAt": null
}
},
{
"skill": {
"id": "7a4ca05f-8d75-44c5-b012-5a0298160903",
"name": "Bachelors Degree > Bachelors Degree Mathematics",
"popularity": "0",
"flagRecount": false,
"createdAt": null,
"updatedAt": null,
},
},
{
"skill": {
"id": "b29215d5-c3cf-4b62-82df-2ee5db1c160c",
"name": "Bachelors Degree > Bachelors Degree history",
"popularity": "0",
"flagRecount": false,
"createdAt": null,
"updatedAt": null
}
}
],
"educations": [
{
"startDate": null,
"endDate": null,
"type": "EDUCATION",
"isPresent": true,
"study": {
"id": "572502d1-fb5c-4876-8985-2c4278b98a8b",
"name":
"Information Engineering and Media, history, Economics, Literature, Mathematics",
"createdAt": "",
"updatedAt": ""
},
"school": {
"id": "f54c85dd-f51e-4715-a393-dbcea6edbed7",
"name": "Adamson University",
"domain": "adamson.edu.ph",
"website": "http://www.adamson.edu.ph/",
"state": null,
"type": null,
"CountryCode": "PH",
"createdAt": null,
"updatedAt": null
},
"degree": {
"id": "63dd0edf-9193-4ac0-b693-ae561873e4a3",
"name": "Bachelor",
"createdAt": "",
"updatedAt": ""
}
},
{
"startDate": null,
"endDate": null,
"type": "EDUCATION",
"isPresent": true,
"school": {
"id": "1dedeca8-154b-4e8f-a867-d359616d996c",
"name": "Adipala Junior High School",
"domain": null,
"website": null,
"state": null,
"type": null,
"CountryCode": null,
"createdAt": "",
"updatedAt": null
}
},
{
"startDate": null,
"endDate": null,
"type": "EDUCATION",
"isPresent": true,
"school": {
"id": "38420130-dac4-4a3c-a1bc-cea4777054c1",
"name": "Unnamed school",
"domain": null,
"website": null,
"state": null,
"type": null,
"CountryCode": null,
"createdAt": null,
"updatedAt": null
}
}
]
}
};
}
and this was the result:
Expected: Some:<Some(ParsedResumeDetails([EducationParsed(true, null, null, null, EDUCATION), EducationParsed(true, null, null, null, EDUCATION), EducationParsed(true, null, null, null, EDUCATION)], [ExperiencesParsed(false, null, Unnamed company, null, WORK)], [Instance of 'SkillWithUserSkill', Instance of 'SkillWithUserSkill', Instance of 'SkillWithUserSkill', Instance of 'SkillWithUserSkill', Instance of 'SkillWithUserSkill'], null))>
Actual: Some:<Some(ParsedResumeDetails([EducationParsed(true, null, null, null, EDUCATION), EducationParsed(true, null, null, null, EDUCATION), EducationParsed(true, null, null, null, EDUCATION)], [ExperiencesParsed(false, null, Unnamed company, null, WORK)], [Instance of 'SkillWithUserSkill', Instance of 'SkillWithUserSkill', Instance of 'SkillWithUserSkill', Instance of 'SkillWithUserSkill', Instance of 'SkillWithUserSkill'], null))>
package:test_api
✖ Upload resume that uploaded into API:
~succeed state~ api get response and parsed it into model JSON "ParsedDetailsResume"
Exited (1)
Any thoughts on this? Thanks!
Ran into same issue trying test async call, where it was failing because I set expected value wrapped in a Future.value()
Solution in this case is to :
extract the value from the async call first with await
then do the check on raw value, without any notion of Future<>
eg:
test('test SomeService()', () async {
final actual = await someService.getSomeList();
expect(actual, []);
});

how to update the first object in the array of quarterFinals that matches some mongoDB condition?

I have the document below and I need to iterate through the quarterFinals array and update the first null address property I find to '123'
{
"data": {
"createTournament": {
"_id": "613122d0c7befdeef3b0b571",
"title": "Jogo de truco",
"description": "",
"location": "Batalha na rua",
"type": "Battle",
"players": [],
"status": "PENDING",
"size": 8,
"entryFee": 1,
"prizePool": 20,
"currency": "USD",
"startDate": "2021-09-01",
"endDate": "2021-09-01",
"rounds": {
"quarterFinals": [{
"id": "9fb6f9ca-c06a-4972-b140-0f2425a90707",
"arena": "",
"firstParticipant": {
"address": null,
"battlesWon": 0
},
"secondParticipant": {
"address": null,
"battlesWon": 0
}
}]
}
}
}
}
One way of doing this is
exports.updateData = async (tournamentID,address)=>{
return await db_collection.updateOne({id:tournamentId,rounds:{$elemMatch:{quarterfinals.address:null}}},{$push:{address:address});
};

How to fix "Can't use $set" error on Mongoose

I'm using mongoose with the given schema:
const StockSchema = new mongoose.Schema(
{
"materialDefinition_id": {
"type": "ObjectId",
"ref": "MaterialDefinition",
"required": true
},
"quantity": {
"type": "Number",
"required": true
},
"committedOrder_id": {
"type": "ObjectId",
"ref": "Order"
},
"committedOrderItemIndex": {
"type": "Number"
},
"detachedOrder_id": {
"type": "ObjectId",
"ref": "Order"
},
"detachedOrderItemIndex": {
"type": "Number"
},
"deletedAt": {
"type": "Number"
},
"createdAt": {
"type": "Number"
},
"updatedAt": {
"type": "Number"
}
});
I'm getting error in the following transaction:
try {
await StockModel.update(
{
$or: [
{ committedOrder_id: purchaseOrder._id },
{ detachedOrder_id: purchaseOrder._id }
]
},
{
$set: {
committedOrder_id: null,
committedOrderItemIndex: null,
detachedOrder_id: null,
detachedOrderItemIndex: null
}
}
);
} catch (err) {
console.log("Error updating stock!");
console.log(err);
}
Error:
Error updating stock!
Error: Can't use $set
at ObjectId.SchemaType.castForQuery (/Users/workspace/dev/app/dev/node_modules/mongoose/lib/schematype.js:1368:13)
at ObjectId.SchemaType.castForQueryWrapper (/Users/workspace/dev/app/dev/node_modules/mongoose/lib/schematype.js:1347:17)
at cast (/Users/workspace/dev/app/dev/node_modules/mongoose/lib/cast.js:288:39)
at model.Query.Query.cast (/Users/workspace/dev/app/dev/node_modules/mongoose/lib/query.js:4644:12)
at model.Query.Query._castConditions (/Users/workspace/dev/app/dev/node_modules/mongoose/lib/query.js:1842:10)
at model.Query.<anonymous> (/Users/workspace/dev/app/dev/node_modules/mongoose/lib/query.js:2097:8)
at model.Query._wrappedThunk [as _findOne] (/Users/workspace/dev/app/dev/node_modules/mongoose/lib/helpers/query/wrapThunk.js:16:8)
at /Users/workspace/dev/app/dev/node_modules/kareem/index.js:369:33
at processTicksAndRejections (internal/process/task_queues.js:75:11)
Any ideas on how to fix it?
From the documentation, update is executed on a document object, see document.prototype.update
You can try this instead:
await StockModel.findOneAndUpdate({
$where: { $or: [{ committedOrder_id: purchaseOrder._id }, { detachedOrder_id: purchaseOrder._id }] },
$set: {
committedOrder_id: null,
committedOrderItemIndex: null,
detachedOrder_id: null,
detachedOrderItemIndex: null
}
});

Grouping select with partial

Hello i have here this code:
public function getConversations($user, $limit, $page)
{
$offset = ($page - 1) * $limit;
$qb = $this->createQueryBuilder('message');
$qb
->select('message, partial o.{id}, partial userFrom.{id, username, avatar}, partial userTo.{id, username, avatar}, partial availability.{id, timeFrom}')
->leftJoin('message.from', 'userFrom')
->leftJoin('message.to', 'userTo')
->leftJoin('message.order', 'o')
->leftJoin('o.availabilities', 'availability')
->where($qb->expr()->orX(
$qb->expr()->eq('message.from', ':user'),
$qb->expr()->eq('message.to', ':user')
))
->setParameter('user', $user)
->setFirstResult($offset)
->setMaxResults($limit)
->addOrderBy('message.created', Criteria::DESC);
return $qb->getQuery()->getArrayResult();
}
I want to get only last message connected to each order. If i have 2 messages to order it gives me 2 rows but i need only one (the last one). I tried to use GROUP BY but it didn't work well. It wanted me to put all foreign ids to group by and then the result was really bad.
Result for this is:
{
"id": "813fa986-f89b-411d-8324-727e427cbc01",
"isRead": false,
"created": {
"date": "2016-12-12 18:01:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"content": "Hello to you too",
"contentType": "text",
"from": {
"id": "3e1806d6-f47e-48b4-afdb-1081d9555a3f",
"avatar": "",
"username": "User two"
},
"to": {
"id": "52ead9fa-b498-400b-967d-b49886ab3118",
"avatar": "",
"username": "User one"
},
"order": {
"id": "8349e718-405a-4e88-8155-3896e9a89fdf",
"availabilities": [
{
"id": "9ddc07e0-be3d-453c-b12f-0ee31bfce444",
"timeFrom": {
"date": "2016-12-03 12:00:00.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
]
}
},
{
"id": "813fa986-f89b-411d-8324-727e427cbc00",
"isRead": false,
"created": {
"date": "2016-12-12 18:00:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"content": "Helllooooooo",
"contentType": "text",
"from": {
"id": "52ead9fa-b498-400b-967d-b49886ab3118",
"avatar": "",
"username": "User one"
},
"to": {
"id": "3e1806d6-f47e-48b4-afdb-1081d9555a3f",
"avatar": "",
"username": "User two"
},
"order": {
"id": "8349e718-405a-4e88-8155-3896e9a89fdf",
"availabilities": [
{
"id": "9ddc07e0-be3d-453c-b12f-0ee31bfce444",
"timeFrom": {
"date": "2016-12-03 12:00:00.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
]
}
and should be just like this:
{
"id": "813fa986-f89b-411d-8324-727e427cbc01",
"isRead": false,
"created": {
"date": "2016-12-12 18:01:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"content": "Hello to you too",
"contentType": "text",
"from": {
"id": "3e1806d6-f47e-48b4-afdb-1081d9555a3f",
"avatar": "",
"username": "User two"
},
"to": {
"id": "52ead9fa-b498-400b-967d-b49886ab3118",
"avatar": "",
"username": "User one"
},
"order": {
"id": "8349e718-405a-4e88-8155-3896e9a89fdf",
"availabilities": [
{
"id": "9ddc07e0-be3d-453c-b12f-0ee31bfce444",
"timeFrom": {
"date": "2016-12-03 12:00:00.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
]
}
}