-
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.
Merge pull request #2039 from CAFECA-IO/feature/test_repo
Feature/test repo
- Loading branch information
Showing
25 changed files
with
584 additions
and
97 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
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,17 @@ | ||
[ | ||
{ | ||
"id": 1000, | ||
"employeeId": 1000, | ||
"startDate": 1630405200, | ||
"endDate": 1630895200, | ||
"salary": 40000, | ||
"insurancePayment": 400, | ||
"bonus": 890, | ||
"description": "salary", | ||
"workingHour": 80, | ||
"confirmed": true, | ||
"createdAt": 1630435200, | ||
"updatedAt": 1630435200, | ||
"deletedAt": null | ||
} | ||
] |
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,10 @@ | ||
[ | ||
{ | ||
"id": 10000099, | ||
"name": "Salary Voucher: 20240809001", | ||
"createdAt": 1723188860, | ||
"updatedAt": 1723188860, | ||
"companyId": 8867, | ||
"deletedAt": null | ||
} | ||
] |
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 |
---|---|---|
@@ -1,59 +1,59 @@ | ||
import { IPaymentBeta } from "@/interfaces/payment"; | ||
import prisma from "@/client"; | ||
import { Prisma, Payment } from "@prisma/client"; | ||
import { getTimestampNow } from "@/lib/utils/common"; | ||
import { IPaymentBeta } from '@/interfaces/payment'; | ||
import prisma from '@/client'; | ||
import { Prisma, Payment } from '@prisma/client'; | ||
import { getTimestampNow } from '@/lib/utils/common'; | ||
|
||
export async function createPayment(payment: IPaymentBeta) { | ||
let result: Payment | null = null; | ||
const nowInSecond = getTimestampNow(); | ||
|
||
const data: Prisma.PaymentCreateInput = { | ||
...payment, | ||
createdAt: nowInSecond, | ||
updatedAt: nowInSecond, | ||
deletedAt: null, | ||
}; | ||
|
||
const paymentCreateArgs = { | ||
data, | ||
}; | ||
|
||
try { | ||
result = await prisma.payment.create(paymentCreateArgs); | ||
} catch (error) { | ||
// Deprecate: ( 20240605 - Murky ) Debugging purpose | ||
// eslint-disable-next-line no-console | ||
console.log(error); | ||
} | ||
|
||
return result; | ||
let result: Payment | null = null; | ||
const nowInSecond = getTimestampNow(); | ||
|
||
const data: Prisma.PaymentCreateInput = { | ||
...payment, | ||
createdAt: nowInSecond, | ||
updatedAt: nowInSecond, | ||
deletedAt: null, | ||
}; | ||
|
||
const paymentCreateArgs = { | ||
data, | ||
}; | ||
|
||
try { | ||
result = await prisma.payment.create(paymentCreateArgs); | ||
} catch (error) { | ||
// Deprecate: ( 20240605 - Murky ) Debugging purpose | ||
// eslint-disable-next-line no-console | ||
console.log(error); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
export async function updatePayment(paymentId: number, payment: IPaymentBeta) { | ||
let result: Payment | null = null; | ||
const nowInSecond = getTimestampNow(); | ||
|
||
const data: Prisma.PaymentUpdateInput = { | ||
...payment, | ||
updatedAt: nowInSecond, | ||
}; | ||
|
||
const where: Prisma.PaymentWhereUniqueInput = { | ||
id: paymentId, | ||
}; | ||
|
||
const paymentUpdateArgs = { | ||
where, | ||
data, | ||
}; | ||
|
||
try { | ||
result = await prisma.payment.update(paymentUpdateArgs); | ||
} catch (error) { | ||
// Deprecate: ( 20240605 - Murky ) Debugging purpose | ||
// eslint-disable-next-line no-console | ||
console.log(error); | ||
} | ||
|
||
return result; | ||
let result: Payment | null = null; | ||
const nowInSecond = getTimestampNow(); | ||
|
||
const data: Prisma.PaymentUpdateInput = { | ||
...payment, | ||
updatedAt: nowInSecond, | ||
}; | ||
|
||
const where: Prisma.PaymentWhereUniqueInput = { | ||
id: paymentId, | ||
}; | ||
|
||
const paymentUpdateArgs = { | ||
where, | ||
data, | ||
}; | ||
|
||
try { | ||
result = await prisma.payment.update(paymentUpdateArgs); | ||
} catch (error) { | ||
// Deprecate: ( 20240605 - Murky ) Debugging purpose | ||
// eslint-disable-next-line no-console | ||
console.log(error); | ||
} | ||
|
||
return result; | ||
} |
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,12 @@ | ||
import { getDepartments } from '@/lib/utils/repo/department.repo'; | ||
import departmentRecords from '@/seed_json/department.json'; | ||
|
||
describe('Department Repository Tests', () => { | ||
describe('getDepartments', () => { | ||
it('should get department records', async () => { | ||
const departments = await getDepartments(); | ||
expect(departments).toBeDefined(); | ||
expect(departments).toEqual(departmentRecords.map((department) => department.name)); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.