-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'FE-Pagination' into testing
- Loading branch information
Showing
34 changed files
with
647 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
Warnings: | ||
- The `createdAt` column on the `EncryptedMessage` table would be dropped and recreated. This will lead to data loss if there is data in the column. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "EncryptedMessage" DROP COLUMN "createdAt", | ||
ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
yarn ts-json-schema-generator -f tsconfig.json --path schema/storage/EditMessageBatchRequest.ts --type _EditMessageBatchRequest -o ./src/schema/storage/EditMessageBatchRequest.schema.json --no-type-check \ | ||
|
||
yarn ts-json-schema-generator -f tsconfig.json --path schema/storage/AddMessageBatchRequest.ts --type _AddMessageBatchRequest -o ./src/schema/storage/AddMessageBatchRequest.schema.json --no-type-check \ | ||
|
||
yarn ts-json-schema-generator -f tsconfig.json --path schema/storage/AddMessageRequest.ts --type _AddMessageRequest -o ./src/schema/storage/AddMessageRequest.schema.json --no-type-check \ | ||
|
||
yarn ts-json-schema-generator -f tsconfig.json --path schema/storage/PaginatedRequest.ts --type _PaginatedRequest -o ./src/schema/storage/PaginatedRequest.schema.json --no-type-check \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
packages/backend/src/schema/storage/AddMessageBatchRequest.schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"$ref": "#/definitions/_AddMessageBatchRequest", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"MessageRecord": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"createdAt": { | ||
"type": "number" | ||
}, | ||
"encryptedEnvelopContainer": { | ||
"type": "string" | ||
}, | ||
"messageId": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"createdAt", | ||
"messageId", | ||
"encryptedEnvelopContainer" | ||
], | ||
"type": "object" | ||
}, | ||
"_AddMessageBatchRequest": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"encryptedContactName": { | ||
"type": "string" | ||
}, | ||
"messageBatch": { | ||
"items": { | ||
"$ref": "#/definitions/MessageRecord" | ||
}, | ||
"type": "array" | ||
} | ||
}, | ||
"required": [ | ||
"messageBatch", | ||
"encryptedContactName" | ||
], | ||
"type": "object" | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/backend/src/schema/storage/AddMessageBatchRequest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import AddMessageBatchRequestSchema from './AddMessageBatchRequest.schema.json'; | ||
import { MessageRecord } from '../../persistence/storage'; | ||
|
||
//This schema defines how the body of the addMessageBatch request has to look like | ||
export interface _AddMessageBatchRequest { | ||
messageBatch: MessageRecord[]; | ||
//The encrypted contact name | ||
encryptedContactName: string; | ||
} | ||
export const AddMessageBatchRequest = AddMessageBatchRequestSchema; |
30 changes: 30 additions & 0 deletions
30
packages/backend/src/schema/storage/AddMessageRequest.schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"$ref": "#/definitions/_AddMessageRequest", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"_AddMessageRequest": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"createdAt": { | ||
"type": "number" | ||
}, | ||
"encryptedContactName": { | ||
"type": "string" | ||
}, | ||
"encryptedEnvelopContainer": { | ||
"type": "string" | ||
}, | ||
"messageId": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"encryptedEnvelopContainer", | ||
"encryptedContactName", | ||
"messageId", | ||
"createdAt" | ||
], | ||
"type": "object" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import AddMessageRequestSchema from './AddMessageRequest.schema.json'; | ||
|
||
//This schema defines how the body of the getMessage request has to look like | ||
export interface _AddMessageRequest { | ||
//The encrypted message container | ||
encryptedEnvelopContainer: string; | ||
//The encrypted contact name | ||
encryptedContactName: string; | ||
//The message id defined by the client | ||
messageId: string; | ||
//The time the message was created, also defined by the client | ||
createdAt: number; | ||
} | ||
export const AddMessageRequest = | ||
AddMessageRequestSchema.definitions._AddMessageRequest; |
45 changes: 45 additions & 0 deletions
45
packages/backend/src/schema/storage/EditMessageBatchRequest.schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"$ref": "#/definitions/_EditMessageBatchRequest", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"MessageRecord": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"createdAt": { | ||
"type": "number" | ||
}, | ||
"encryptedEnvelopContainer": { | ||
"type": "string" | ||
}, | ||
"messageId": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"createdAt", | ||
"messageId", | ||
"encryptedEnvelopContainer" | ||
], | ||
"type": "object" | ||
}, | ||
"_EditMessageBatchRequest": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"editMessageBatchPayload": { | ||
"items": { | ||
"$ref": "#/definitions/MessageRecord" | ||
}, | ||
"type": "array" | ||
}, | ||
"encryptedContactName": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"encryptedContactName", | ||
"editMessageBatchPayload" | ||
], | ||
"type": "object" | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/backend/src/schema/storage/EditMessageBatchRequest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import EditMessageBatchRequestSchema from './EditMessageBatchRequest.schema.json'; | ||
import { _AddMessageRequest } from './AddMesssageRequest'; | ||
import { MessageRecord } from '../../persistence/storage'; | ||
|
||
//This schema defines how the body of the editMessageBatch request has to look like | ||
export interface _EditMessageBatchRequest { | ||
encryptedContactName: string; | ||
editMessageBatchPayload: MessageRecord[]; | ||
} | ||
export const EditMessageBatchRequest = EditMessageBatchRequestSchema; |
22 changes: 22 additions & 0 deletions
22
packages/backend/src/schema/storage/PaginatedRequest.schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"$ref": "#/definitions/_PaginatedRequest", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"_PaginatedRequest": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"offset": { | ||
"type": "number" | ||
}, | ||
"pageSize": { | ||
"type": "number" | ||
} | ||
}, | ||
"required": [ | ||
"pageSize", | ||
"offset" | ||
], | ||
"type": "object" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import PaginatedRequestSchema from './PaginatedRequest.schema.json'; | ||
|
||
//This schema defines how the body of the GetMessages request has to look like | ||
export interface _PaginatedRequest { | ||
pageSize: number; | ||
offset: number; | ||
} | ||
export const PaginatedRequest = { | ||
...PaginatedRequestSchema, | ||
definitions: { | ||
...PaginatedRequestSchema.definitions, | ||
_PaginatedRequest: { | ||
...PaginatedRequestSchema.definitions._PaginatedRequest, | ||
properties: { | ||
...PaginatedRequestSchema.definitions._PaginatedRequest | ||
.properties, | ||
//Extending schema to prevent negative numbers | ||
pageSize: { type: 'number', minimum: 0 }, | ||
offset: { type: 'number', minimum: 0 }, | ||
}, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.