feat: remove OTP gate from transactions, fix categories auth, add implementation plan
- Remove OtpGateGuard from transactions controller (OTP verified at login) - Fix categories controller to use authenticated user instead of TEMP_USER_ID - Add comprehensive implementation plan document - Update .env.example with WEB_APP_URL - Prepare for admin dashboard development
This commit is contained in:
22
apps/api/dist/wallets/wallets.service.js
vendored
22
apps/api/dist/wallets/wallets.service.js
vendored
@@ -12,36 +12,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WalletsService = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const prisma_service_1 = require("../prisma/prisma.service");
|
||||
const user_util_1 = require("../common/user.util");
|
||||
let WalletsService = class WalletsService {
|
||||
prisma;
|
||||
constructor(prisma) {
|
||||
this.prisma = prisma;
|
||||
}
|
||||
userId() {
|
||||
return (0, user_util_1.getTempUserId)();
|
||||
}
|
||||
list() {
|
||||
list(userId) {
|
||||
return this.prisma.wallet.findMany({
|
||||
where: { userId: this.userId(), deletedAt: null },
|
||||
where: { userId, deletedAt: null },
|
||||
orderBy: { createdAt: 'asc' },
|
||||
});
|
||||
}
|
||||
create(input) {
|
||||
create(userId, input) {
|
||||
const kind = input.kind ?? 'money';
|
||||
return this.prisma.wallet.create({
|
||||
data: {
|
||||
userId: this.userId(),
|
||||
userId,
|
||||
name: input.name,
|
||||
kind,
|
||||
currency: kind === 'money' ? (input.currency ?? 'IDR') : null,
|
||||
unit: kind === 'asset' ? (input.unit ?? null) : null,
|
||||
initialAmount: input.initialAmount || null,
|
||||
pricePerUnit: kind === 'asset' ? (input.pricePerUnit || null) : null,
|
||||
pricePerUnit: kind === 'asset' ? input.pricePerUnit || null : null,
|
||||
},
|
||||
});
|
||||
}
|
||||
update(id, input) {
|
||||
update(userId, id, input) {
|
||||
const updateData = {};
|
||||
if (input.name !== undefined)
|
||||
updateData.name = input.name;
|
||||
@@ -67,13 +63,13 @@ let WalletsService = class WalletsService {
|
||||
if (input.pricePerUnit !== undefined)
|
||||
updateData.pricePerUnit = input.pricePerUnit || null;
|
||||
return this.prisma.wallet.update({
|
||||
where: { id, userId: this.userId() },
|
||||
where: { id, userId },
|
||||
data: updateData,
|
||||
});
|
||||
}
|
||||
delete(id) {
|
||||
delete(userId, id) {
|
||||
return this.prisma.wallet.update({
|
||||
where: { id, userId: this.userId() },
|
||||
where: { id, userId },
|
||||
data: { deletedAt: new Date() },
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user