Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apis init #3

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e9ee426
apis init
SanchitUke Sep 22, 2023
723f1f4
response objects
SanchitEsMagico Sep 22, 2023
1532958
swagger module implementation
SanchitEsMagico Sep 22, 2023
bf22ee3
review changes and docker
SanchitEsMagico Oct 3, 2023
799953c
enduser to consumer
SanchitEsMagico Oct 3, 2023
42eed9a
readme updated
SanchitEsMagico Oct 11, 2023
1087ef9
added services diagram
SanchitEsMagico Oct 13, 2023
d07a34c
changed userId to uuid
SanchitEsMagico Nov 9, 2023
6be1526
minor debugging
SanchitEsMagico Nov 9, 2023
77c8992
Added seed data
kh4l1d64 Nov 14, 2023
43232cd
logger and error handling
SanchitEsMagico Nov 14, 2023
19e7114
request type fix
SanchitEsMagico Nov 14, 2023
6a2da72
error fixes
SanchitEsMagico Nov 16, 2023
bba68cd
utils change
SanchitEsMagico Nov 20, 2023
0e8be47
Error message
SanchitEsMagico Nov 27, 2023
39a0789
get all user credits
SanchitEsMagico Nov 28, 2023
824ce71
settlement update
SanchitEsMagico Nov 28, 2023
bd10c0f
seed update
SanchitEsMagico Nov 28, 2023
5e79c39
seed update
SanchitEsMagico Dec 1, 2023
bd7f7f8
refund credits for failed purchase
SanchitEsMagico Dec 7, 2023
2bb9589
seed update
SanchitEsMagico Dec 12, 2023
a9323b3
Updating the docker file for deployment
Dec 13, 2023
d9e5135
Adding final changes for deployment
Dec 15, 2023
b34ebb0
Added logs and updated seed data
kh4l1d64 Apr 17, 2024
335d9fd
Delete .env
kh4l1d64 Apr 17, 2024
743b9f3
Update env-sample
kh4l1d64 Apr 17, 2024
87baba7
Added wallet delete API
kh4l1d64 Apr 21, 2024
8c5bcd1
Creating views for data visualization.
VamshiBatta07 Jul 17, 2024
2588164
Merge pull request #4 from COMPASS-DPG/feature/create-views
VamshiBatta07 Jul 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
dist
SanchitEsMagico marked this conversation as resolved.
Show resolved Hide resolved
98 changes: 93 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"prisma": {
"seed": "ts-node prisma/seed.ts"
},
"dependencies": {
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/swagger": "^7.1.12",
"@prisma/client": "^5.3.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1"
},
Expand Down
SanchitEsMagico marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Warnings:

- A unique constraint covering the columns `[userId]` on the table `wallets` will be added. If there are existing duplicate values, this will fail.

*/
-- CreateIndex
CREATE UNIQUE INDEX "wallets_userId_key" ON "wallets"("userId");
12 changes: 12 additions & 0 deletions prisma/migrations/20230921071650_transaction_type/migration.sql
SanchitEsMagico marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Warnings:

- Added the required column `type` to the `transactions` table without a default value. This is not possible if the table is not empty.

*/
-- CreateEnum
CREATE TYPE "TransactionType" AS ENUM ('purchase', 'creditRequest', 'settlement');

-- AlterTable
ALTER TABLE "transactions" ADD COLUMN "type" "TransactionType" NOT NULL,
ALTER COLUMN "description" DROP NOT NULL;
12 changes: 10 additions & 2 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ enum WalletStatus {
frozen
}

enum TransactionType {
purchase
creditRequest
settlement
}
SanchitEsMagico marked this conversation as resolved.
Show resolved Hide resolved


model wallets {
walletId Int @id @default(autoincrement())
userId Int
userId Int @unique
type WalletType
status WalletStatus
credits Int
Expand All @@ -39,7 +46,8 @@ model transactions {
fromId Int
toId Int
credits Int
description String
type TransactionType
description String?
createdAt DateTime @default(now())
from wallets @relation("FromTransaction", fields:[fromId], references:[walletId])
to wallets @relation("ToTransaction", fields:[toId], references:[walletId])
Expand Down
23 changes: 23 additions & 0 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { PrismaClient, TransactionType, WalletStatus, WalletType } from '@prisma/client'
const prisma = new PrismaClient()
async function main() {
const wallet = await prisma.transactions.create({
data: {
credits: 15,
fromId: 6,
toId: 10,
type: TransactionType.settlement,

}
})
console.log({ wallet })
}
main()
.then(async () => {
await prisma.$disconnect()
})
.catch(async (e) => {
console.error(e)
await prisma.$disconnect()
process.exit(1)
})
Loading