chore(workspace): eradicate all tsc errors and eslint warnings across frontend, admin, and backend
Deploy Canina / deploy (push) Failing after 29s
Deploy Canina / deploy (push) Failing after 29s
This commit is contained in:
1 parent
4659a7b1de
commit
9f11d8fb2d
98 files changed
+1272
-1009
No files matched your search
@@ -1,6 +1,18 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
|
||||
export interface UserAddressInput {
|
||||
title: string;
|
||||
receptorName: string;
|
||||
phone: string;
|
||||
province: string;
|
||||
city: string;
|
||||
detail: string;
|
||||
zipCode: string;
|
||||
isDefault?: boolean;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class UsersService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
@@ -37,7 +49,7 @@ export class UsersService {
|
||||
});
|
||||
}
|
||||
|
||||
async update(id: string, data: any) {
|
||||
async update(id: string, data: Prisma.UserUpdateInput) {
|
||||
return this.prisma.user.update({
|
||||
where: { id },
|
||||
data,
|
||||
@@ -56,7 +68,7 @@ export class UsersService {
|
||||
});
|
||||
}
|
||||
|
||||
async addAddress(userId: string, data: any) {
|
||||
async addAddress(userId: string, data: UserAddressInput) {
|
||||
if (data.isDefault) {
|
||||
await this.prisma.userAddress.updateMany({
|
||||
where: { userId },
|
||||
@@ -78,7 +90,11 @@ export class UsersService {
|
||||
});
|
||||
}
|
||||
|
||||
async updateAddress(userId: string, addressId: string, data: any) {
|
||||
async updateAddress(
|
||||
userId: string,
|
||||
addressId: string,
|
||||
data: UserAddressInput,
|
||||
) {
|
||||
if (data.isDefault) {
|
||||
await this.prisma.userAddress.updateMany({
|
||||
where: { userId, NOT: { id: addressId } },
|
||||
|
||||
Reference in new issue
Block a user