This repository has been archived by the owner on Oct 30, 2024. It is now read-only.
forked from documenso/documenso
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sql): use TypedSQL for all queryRaw and kysely queries
- Loading branch information
Showing
14 changed files
with
3,678 additions
and
8,162 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
22 changes: 2 additions & 20 deletions
22
packages/lib/server-only/user/get-monthly-completed-document.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
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
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,9 @@ | ||
SELECT | ||
DATE_TRUNC('month', "updatedAt") AS "month", | ||
COUNT("id") as "count", | ||
SUM(COUNT("id")) OVER (ORDER BY DATE_TRUNC('month', "updatedAt")) as "cume_count" | ||
FROM "Document" | ||
WHERE "status" = 'COMPLETED' | ||
GROUP BY "month" | ||
ORDER BY "month" DESC | ||
LIMIT 12 |
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 @@ | ||
SELECT | ||
DATE_TRUNC('month', "User"."createdAt") AS "month", | ||
COUNT(DISTINCT "Recipient"."email") as "count", | ||
SUM(COUNT(DISTINCT "Recipient"."email")) OVER (ORDER BY DATE_TRUNC('month', "User"."createdAt")) as "cume_count" | ||
FROM "Recipient" | ||
INNER JOIN "User" ON "Recipient"."email" = "User"."email" | ||
WHERE "Recipient"."signedAt" IS NOT NULL | ||
AND "Recipient"."signedAt" < "User"."createdAt" | ||
GROUP BY DATE_TRUNC('month', "User"."createdAt") | ||
ORDER BY "month" DESC |
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,8 @@ | ||
SELECT | ||
DATE_TRUNC('MONTH', "User"."createdAt") AS "month", | ||
COUNT("id") AS "count", | ||
SUM(COUNT("id")) OVER (ORDER BY DATE_TRUNC('MONTH', "User"."createdAt")) AS "cume_count" | ||
FROM "User" | ||
GROUP BY "month" | ||
ORDER BY "month" DESC | ||
LIMIT 12; |
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,8 @@ | ||
SELECT | ||
DATE_TRUNC('month', "Document"."createdAt") AS "month", | ||
COUNT(DISTINCT "Document"."userId") as "count", | ||
COUNT(DISTINCT CASE WHEN "Document"."status" = 'COMPLETED' THEN "Document"."userId" END) as "signed_count" | ||
FROM "Document" | ||
GROUP BY "month" | ||
ORDER BY "month" DESC | ||
LIMIT 12 |