feat: added save record request model with tests

This commit is contained in:
StevanFreeborn
2023-02-12 22:14:55 -06:00
parent 71ef5ffb07
commit 78f9be32e9
5 changed files with 99 additions and 4 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ export class GetRecordsByAppIdRequest {
/**
* @property {DataFormat} dataFormat - The format of the data in the response.
*/
public dataFormat: DataFormat;
public dataFormat: DataFormat = DataFormat.Raw;
/**
* @property {PagingRequest} pagingRequest - The paging request.
+1 -1
View File
@@ -26,7 +26,7 @@ export class Record {
* @param {RecordValue[]} fieldData - The data for the fields in the record.
* @returns {Record} - A new instance of Record.
*/
constructor(appId: number, recordId: number, fieldData: RecordValue[]) {
constructor(appId: number, recordId: number, fieldData: RecordValue[] = []) {
this.appId = appId;
this.recordId = recordId;
this.fieldData = fieldData;
+28
View File
@@ -0,0 +1,28 @@
export class SaveRecordRequest {
/**
* @property {number} appId - The id of the app that the record belongs to.
*/
public appId: number;
/**
* @property {number} recordId - The id of the record.
* @remarks If the record id is not provided a new record will be created. Otherwise, the existing record will be updated.
*/
public recordId: number | null;
/**
* @property {Map<number, any>} fields - The data for the fields in the record.
* @remarks The key is the field id and the value is the value for the field.
*/
public fields: Map<number, any>;
constructor(
appId: number,
recordId: number | null = null,
fields: Map<number, any> = new Map<number, any>()
) {
this.appId = appId;
this.recordId = recordId;
this.fields = fields;
}
}