-
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.
* add review api * minor change --------- Co-authored-by: lamnv <[email protected]> Co-authored-by: NHT <[email protected]>
- Loading branch information
1 parent
750a60f
commit 68eeca9
Showing
8 changed files
with
506 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { | ||
Entity, | ||
PrimaryGeneratedColumn, | ||
Column, | ||
ManyToOne, | ||
JoinColumn, | ||
CreateDateColumn, | ||
} from 'typeorm'; | ||
import { Driver } from './driver.entity'; | ||
import { Order } from './order.entity'; | ||
import { Customer } from './customer.entity'; | ||
|
||
@Entity('Driver_Rating') | ||
export class DriverRating { | ||
@PrimaryGeneratedColumn() | ||
driver_rating_id: number; | ||
|
||
@Column({ type: 'int', nullable: false, unique: false }) | ||
driver_id: number; | ||
|
||
@ManyToOne(() => Driver) | ||
@JoinColumn({ name: 'driver_id', referencedColumnName: 'driver_id' }) | ||
driver: Driver; | ||
|
||
@Column({ type: 'int', nullable: false, unique: false }) | ||
order_id: number; | ||
|
||
@ManyToOne(() => Order) | ||
@JoinColumn({ name: 'order_id', referencedColumnName: 'order_id' }) | ||
order: Order; | ||
|
||
@Column({ type: 'tinyint', nullable: false, unique: false }) | ||
score: number; | ||
|
||
@Column({ type: 'text', nullable: true, unique: false }) | ||
remarks: string; | ||
|
||
@Column({ type: 'int', nullable: false, unique: false }) | ||
customer_id: number; | ||
|
||
@ManyToOne(() => Customer) | ||
@JoinColumn({ name: 'customer_id', referencedColumnName: 'customer_id' }) | ||
customer: Customer; | ||
|
||
@Column({ type: 'tinyint', nullable: false, unique: false, default: 1 }) | ||
is_active: number; | ||
|
||
@CreateDateColumn({ | ||
type: 'datetime', | ||
nullable: false, | ||
unique: false, | ||
default: () => 'CURRENT_TIMESTAMP', | ||
}) | ||
public created_at: Date; | ||
} |
3 changes: 3 additions & 0 deletions
3
src/feature/rating-and-review/dto/create-review-response.dto.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export class CreateOrderReviewResponse { | ||
message: string; | ||
} |
4 changes: 4 additions & 0 deletions
4
src/feature/rating-and-review/dto/get-review-form-request.dto.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export class GetReviewFormRequest { | ||
customer_id: number; | ||
order_id: number; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/feature/rating-and-review/dto/get-review-form-response.dto.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export class GetReviewFormResponse { | ||
customer_id: number; | ||
order_id: number; | ||
order_date: number; | ||
driver_id: number; | ||
order_items: OrderItem[]; | ||
} | ||
export interface OrderItem { | ||
order_sku_id: number; | ||
name: TextByLang[]; | ||
price: number; | ||
advanced_taste_customization: string; | ||
basic_taste_customization: string; | ||
portion_customization: string; | ||
} | ||
interface TextByLang { | ||
ISO_language_code: string; | ||
text: string; | ||
} |
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,25 @@ | ||
interface PostReviewRequest { | ||
customer_id: number; | ||
order_id: number; | ||
driver_review: DriverReview; | ||
food_reviews: FoodReview[]; | ||
} | ||
|
||
interface DriverReview { | ||
driver_id: number; | ||
score: number; // from 1-5 | ||
remarks: string; | ||
img_urls: string[]; | ||
} | ||
|
||
interface FoodReview { | ||
order_sku_id: number; | ||
score: number; // from 1-5 | ||
remarks: string; | ||
img_urls: string[]; | ||
} | ||
|
||
interface GetReviewFormRequest { | ||
customer_id: number; | ||
order_id: number; | ||
} |
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
Oops, something went wrong.