Files
medusa-store/packages/medusa/src/models/claim-image.ts
T
Shahed Nasser 91615f9c45 chore: improve JS Client TSDoc comments (#5582)
* add oas schema to tsdoc parser

* add tsdoc (part 1)

* Finished tsdoc in js client

* general fixes

* added tsdoc in core medusa package

* parse schema tags in model files

* added maxlevel option

* added more tsdoc

* added tsdoc in core

* added TSDoc in core package

* generated client types

* support featureFlag and expandable tags

* added support for resource feature flag note

* fix api ignore plugin

* added eslint plugin

* support feature flag and expandable badges

* adjusted overview page + generated reference

* revert generated files

* added changeset

* add details about new typedoc options

* fix broken link
2023-11-09 12:51:17 +02:00

92 lines
2.4 KiB
TypeScript

import {
BeforeInsert,
Column,
Entity,
Index,
JoinColumn,
ManyToOne,
} from "typeorm"
import { ClaimItem } from "./claim-item"
import { DbAwareColumn } from "../utils/db-aware-column"
import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity"
import { generateEntityId } from "../utils/generate-entity-id"
@Entity()
export class ClaimImage extends SoftDeletableEntity {
@Index()
@Column()
claim_item_id: string
@ManyToOne(() => ClaimItem, (ci) => ci.images)
@JoinColumn({ name: "claim_item_id" })
claim_item: ClaimItem
@Column()
url: string
@DbAwareColumn({ type: "jsonb", nullable: true })
metadata: Record<string, unknown>
/**
* @apiIgnore
*/
@BeforeInsert()
private beforeInsert(): void {
this.id = generateEntityId(this.id, "cimg")
}
}
/**
* @schema ClaimImage
* title: "Claim Image"
* description: "The details of an image attached to a claim."
* type: object
* required:
* - claim_item_id
* - created_at
* - deleted_at
* - id
* - metadata
* - updated_at
* - url
* properties:
* id:
* description: The claim image's ID
* type: string
* example: cimg_01G8ZH853Y6TFXWPG5EYE81X63
* claim_item_id:
* description: The ID of the claim item associated with the image
* type: string
* claim_item:
* description: The details of the claim item this image is associated with.
* nullable: true
* x-expandable: "claim_item"
* $ref: "#/components/schemas/ClaimItem"
* url:
* description: The URL of the image
* type: string
* format: uri
* created_at:
* description: The date with timezone at which the resource was created.
* type: string
* format: date-time
* updated_at:
* description: The date with timezone at which the resource was updated.
* type: string
* format: date-time
* deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string
* format: date-time
* metadata:
* description: An optional key-value map with additional details
* nullable: true
* type: object
* example: {car: "white"}
* externalDocs:
* description: "Learn about the metadata attribute, and how to delete and update it."
* url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"
*/