known-license.model.ts 969 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { BaseModel, Model, ManyToOne, StringField } from 'warthog';
  2. import { Block } from '../block/block.model';
  3. @Model({ api: {} })
  4. export class KnownLicense extends BaseModel {
  5. @StringField({
  6. description: `Short, commonly recognized code of the licence (ie. CC_BY_SA)`,
  7. unique: true,
  8. })
  9. code!: string;
  10. @StringField({
  11. nullable: true,
  12. description: `Full, descriptive name of the license (ie. Creative Commons - Attribution-NonCommercial-NoDerivs)`,
  13. })
  14. name?: string;
  15. @StringField({
  16. nullable: true,
  17. description: `Short description of the license conditions`,
  18. })
  19. description?: string;
  20. @StringField({
  21. nullable: true,
  22. description: `An url pointing to full license content`,
  23. })
  24. url?: string;
  25. @ManyToOne(() => Block, (param: Block) => param.knownLicenses, {
  26. skipGraphQLField: true,
  27. })
  28. happenedIn!: Block;
  29. constructor(init?: Partial<KnownLicense>) {
  30. super();
  31. Object.assign(this, init);
  32. }
  33. }