chore: changed the return data to use spread operator
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
-- CreateEnum
|
||||||
|
CREATE TYPE "ReqType" AS ENUM ('REST', 'GQL');
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "UserHistory" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"userUid" TEXT NOT NULL,
|
||||||
|
"type" "ReqType" NOT NULL,
|
||||||
|
"request" JSONB NOT NULL,
|
||||||
|
"responseMetadata" JSONB NOT NULL,
|
||||||
|
"isStarred" BOOLEAN NOT NULL,
|
||||||
|
"executedOn" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
|
||||||
|
CONSTRAINT "UserHistory_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "UserHistory" ADD CONSTRAINT "UserHistory_userUid_fkey" FOREIGN KEY ("userUid") REFERENCES "User"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
@@ -32,13 +32,10 @@ export class UserHistoryService {
|
|||||||
const userHistoryColl: UserHistory[] = userHistory.map(
|
const userHistoryColl: UserHistory[] = userHistory.map(
|
||||||
(history) =>
|
(history) =>
|
||||||
<UserHistory>{
|
<UserHistory>{
|
||||||
id: history.id,
|
...history,
|
||||||
userUid: history.userUid,
|
|
||||||
reqType: history.type,
|
reqType: history.type,
|
||||||
request: JSON.stringify(history.request),
|
request: JSON.stringify(history.request),
|
||||||
responseMetadata: JSON.stringify(history.responseMetadata),
|
responseMetadata: JSON.stringify(history.responseMetadata),
|
||||||
isStarred: history.isStarred,
|
|
||||||
executedOn: history.executedOn,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -73,13 +70,10 @@ export class UserHistoryService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const userHistory = <UserHistory>{
|
const userHistory = <UserHistory>{
|
||||||
id: history.id,
|
...history,
|
||||||
userUid: history.userUid,
|
reqType: history.type,
|
||||||
request: JSON.stringify(history.request),
|
request: JSON.stringify(history.request),
|
||||||
responseMetadata: JSON.stringify(history.responseMetadata),
|
responseMetadata: JSON.stringify(history.responseMetadata),
|
||||||
executedOn: history.executedOn,
|
|
||||||
isStarred: history.isStarred,
|
|
||||||
reqType: history.type,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Publish created user history subscription
|
// Publish created user history subscription
|
||||||
@@ -118,13 +112,10 @@ export class UserHistoryService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const updatedUserHistory = <UserHistory>{
|
const updatedUserHistory = <UserHistory>{
|
||||||
id: updatedHistory.id,
|
...updatedHistory,
|
||||||
userUid: updatedHistory.userUid,
|
reqType: updatedHistory.type,
|
||||||
request: JSON.stringify(updatedHistory.request),
|
request: JSON.stringify(updatedHistory.request),
|
||||||
responseMetadata: JSON.stringify(updatedHistory.responseMetadata),
|
responseMetadata: JSON.stringify(updatedHistory.responseMetadata),
|
||||||
executedOn: updatedHistory.executedOn,
|
|
||||||
isStarred: updatedHistory.isStarred,
|
|
||||||
reqType: updatedHistory.type,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Publish updated user history subscription
|
// Publish updated user history subscription
|
||||||
@@ -153,13 +144,10 @@ export class UserHistoryService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const deletedUserHistory = <UserHistory>{
|
const deletedUserHistory = <UserHistory>{
|
||||||
id: delUserHistory.id,
|
...delUserHistory,
|
||||||
userUid: delUserHistory.userUid,
|
reqType: delUserHistory.type,
|
||||||
request: JSON.stringify(delUserHistory.request),
|
request: JSON.stringify(delUserHistory.request),
|
||||||
responseMetadata: JSON.stringify(delUserHistory.responseMetadata),
|
responseMetadata: JSON.stringify(delUserHistory.responseMetadata),
|
||||||
executedOn: delUserHistory.executedOn,
|
|
||||||
isStarred: delUserHistory.isStarred,
|
|
||||||
reqType: delUserHistory.type,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Publish deleted user history subscription
|
// Publish deleted user history subscription
|
||||||
|
|||||||
Reference in New Issue
Block a user