Skip to content

Commit

Permalink
ubah panjang data database sesuai kebutuhan
Browse files Browse the repository at this point in the history
  • Loading branch information
XSmas29 committed Oct 8, 2024
1 parent 0488187 commit 4228bf0
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion src/entities/Attribute.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class Attribute extends BaseEntity {
id!: number

@Field()
@Column()
@Column({length: 50})
name!: string

@Field()
Expand Down
2 changes: 1 addition & 1 deletion src/entities/AttributeOption.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class AttributeOption extends BaseEntity {
id!: number

@Field()
@Column()
@Column({length: 50})
name!: string

@Field()
Expand Down
2 changes: 1 addition & 1 deletion src/entities/Category.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Category extends BaseEntity {
id!: number

@Field()
@Column()
@Column({length: 50})
name!: string

@Field(() => [Product])
Expand Down
2 changes: 1 addition & 1 deletion src/entities/Chat.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class Chat extends BaseEntity {
id!: number

@Field()
@Column()
@Column({length: 50})
title!: string

@Field(() => CustomTransaction)
Expand Down
4 changes: 2 additions & 2 deletions src/entities/ChatMessage.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export class ChatMessage extends BaseEntity {
id!: number

@Field({nullable: true})
@Column('longtext', {nullable: true})
@Column({nullable: true, length: 1000})
message?: string

@Field({nullable: true})
@Column({nullable: true})
@Column({nullable: true, length: 50})
image?: string

@Field(() => Chat)
Expand Down
4 changes: 2 additions & 2 deletions src/entities/Complaint.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export class Complaint extends BaseEntity {
type!: ComplaintType

@Field()
@Column()
@Column({length: 1000})
description!: string

@Field({nullable: true})
@Column({nullable: true})
@Column({nullable: true, length: 50})
image?: string

@Field({nullable: true})
Expand Down
2 changes: 1 addition & 1 deletion src/entities/ComplaintType.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ export class ComplaintType extends BaseEntity {
complaints!: Complaint[]

@Field()
@Column()
@Column({length: 20})
name!: string
}
6 changes: 3 additions & 3 deletions src/entities/Course.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Course extends BaseEntity {
id!: number

@Field()
@Column()
@Column({length: 25})
name!: string

@Field(() => [CourseTransaction])
Expand All @@ -20,7 +20,7 @@ export class Course extends BaseEntity {
course_transactions!: CourseTransaction[]

@Field()
@Column({length: '1000', collation: 'utf8mb4_bin'})
@Column({length: 1000, collation: 'utf8mb4_bin'})
description!: string

@Field()
Expand All @@ -36,6 +36,6 @@ export class Course extends BaseEntity {
promo_min_amount!: number

@Field()
@Column()
@Column({length: 20})
time!: string
}
4 changes: 2 additions & 2 deletions src/entities/CourseTransaction.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class CourseTransaction extends BaseEntity {
total_price!: number

@Field({ nullable: true })
@Column({ nullable: true })
@Column({ nullable: true, length: 20 })
payment_method?: string

@Field(() => TransactionStatus)
Expand All @@ -48,7 +48,7 @@ export class CourseTransaction extends BaseEntity {
start_date!: Date

@Field()
@Column()
@Column({length: 20})
time_slot!: string

@Field({ nullable: true })
Expand Down
24 changes: 12 additions & 12 deletions src/entities/CustomTransaction.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Complaint } from './Complaint.entity'
@Entity({name: 'custom_transactions'})
export class CustomTransaction extends BaseEntity {
@Field()
@PrimaryColumn()
@PrimaryColumn({length: 50})
id!: string

@Field(() => User)
Expand All @@ -36,11 +36,11 @@ export class CustomTransaction extends BaseEntity {
complaints!: Complaint[]

@Field()
@Column()
@Column({length: 50})
product_name!: string

@Field()
@Column({length: '1000', collation: 'utf8mb4_bin'})
@Column({length: 1000, collation: 'utf8mb4_bin'})
product_description!: string

@Field()
Expand All @@ -61,43 +61,43 @@ export class CustomTransaction extends BaseEntity {
total_price?: number

@Field({ nullable: true })
@Column({ nullable: true })
@Column({ nullable: true, length: 40 })
resi_number?: string

@Field({nullable: true})
@Column({nullable: true})
shipping_cost?: number

@Field({nullable: true})
@Column({nullable: true})
@Column({nullable: true, length: 25})
shipping_service?: string

@Field({nullable: true})
@Column({nullable: true})
@Column({nullable: true, length: 50})
shipping_address?: string

@Field({nullable: true})
@Column({nullable: true})
@Column({nullable: true, length: 25})
shipping_city?: string

@Field({nullable: true})
@Column({nullable: true})
@Column({nullable: true, length: 10})
shipping_postal_code?: string

@Field({nullable: true})
@Column({nullable: true})
@Column({nullable: true, length: 15})
customer_phone?: string

@Field({nullable: true})
@Column({nullable: true})
@Column({nullable: true, length: 50})
customer_name?: string

@Field({nullable: true})
@Column({nullable: true})
@Column({nullable: true, length: 50})
customer_email?: string

@Field({nullable: true})
@Column({nullable: true})
@Column({nullable: true, length: 20})
payment_method?: string

@Field({ nullable: true })
Expand Down
4 changes: 2 additions & 2 deletions src/entities/DeliveryProvider.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export class DeliveryProvider extends BaseEntity {
id!: number

@Field()
@Column()
@Column({length: 25})
name!: string

@Field()
@Column()
@Column({length: 10})
code!: string
}
2 changes: 1 addition & 1 deletion src/entities/Image.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class Image extends BaseEntity {
id!: number

@Field()
@Column()
@Column({length: 50})
path!: string

@Field(() => Variant, {nullable: true})
Expand Down
2 changes: 1 addition & 1 deletion src/entities/Material.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Material extends BaseEntity {
id!: number

@Field()
@Column()
@Column({length: 50})
name!: string

@Field(() => [Product])
Expand Down
6 changes: 3 additions & 3 deletions src/entities/Product.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ export class Product extends BaseEntity {
id!: number

@Field()
@Column()
@Column({length: 50})
name!: string

@Field()
@Column({length: '1000', collation: 'utf8mb4_bin'})
@Column({length: 1000, collation: 'utf8mb4_bin'})
description!: string

@Field()
@Column()
@Column({length: 50})
slug!: string

@Field()
Expand Down
20 changes: 10 additions & 10 deletions src/entities/TransactionHeader.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { TransactionStatus } from '@entity/TransactionStatus.entity'
@Entity({name: 'transaction_headers'})
export class TransactionHeader extends BaseEntity {
@Field()
@PrimaryColumn()
@PrimaryColumn({length: 50})
id!: string

@Field(() => User)
Expand All @@ -35,39 +35,39 @@ export class TransactionHeader extends BaseEntity {
shipping_cost!: number

@Field({ nullable: true })
@Column({ nullable: true })
@Column({ nullable: true, length: 40 })
resi_number?: string

@Field()
@Column()
@Column({length: 25})
shipping_service!: string

@Field()
@Column()
@Column({length: 50})
shipping_address!: string

@Field()
@Column()
@Column({length: 25})
shipping_city!: string

@Field()
@Column()
@Column({length: 10})
shipping_postal_code!: string

@Field()
@Column()
@Column({length: 15})
customer_phone?: string

@Field()
@Column()
@Column({length: 50})
customer_name!: string

@Field()
@Column()
@Column({length: 50})
customer_email!: string

@Field({ nullable: true })
@Column({ nullable: true })
@Column({ nullable: true, length: 20 })
payment_method?: string

@Field({ nullable: true })
Expand Down
2 changes: 1 addition & 1 deletion src/entities/TransactionStatus.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class TransactionStatus extends BaseEntity {
id!: number

@Field()
@Column()
@Column({length: 25})
status!: string

@Field()
Expand Down
16 changes: 8 additions & 8 deletions src/entities/User.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,34 @@ export class User extends BaseEntity {
id!: number

@Field({nullable: true})
@Column({nullable: true})
@Column({nullable: true, default: '', length: 25})
first_name!: string

@Field()
@Column({default: ''})
@Column({default: '', length: 25})
last_name!: string

@Field({nullable: true})
@Column({nullable: true})
@Column({nullable: true, length: 25})
phone?: string

@Field()
@Column({unique: true})
@Column({unique: true, length: 50})
email!: string

@Column({nullable: true})
@Column({nullable: true, length: 100})
password!: string

@Field()
@Column({ default: false})
is_verified!: boolean

@Field()
@Column()
@Column({ length: 255 })
hash!: string

@Field(() => String, {nullable: true})
@Column("varchar", {nullable: true})
@Column("varchar", {nullable: true, length: 255})
reset_password_hash?: string | null

@Field()
Expand All @@ -60,7 +60,7 @@ export class User extends BaseEntity {
@DeleteDateColumn()
deleted_at!: Date

@Column({nullable: true, length: 1000})
@Column({nullable: true, length: 500})
refresh_token!: string

@Field(() => [TransactionHeader])
Expand Down
2 changes: 1 addition & 1 deletion src/entities/Variant.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Variant extends BaseEntity {
price!: number

@Field()
@Column()
@Column({length: 50})
sku!: string

@Field()
Expand Down

0 comments on commit 4228bf0

Please sign in to comment.