Art Module

Generating the art module

Create module

This creates a new codegen module

pnx g @logosphere/sdk:module --name art

Take a look at the project structure under libs/art-gen/src

Edit model file

In this step, similar to the music module, we will create a simple model for the art domain, consisting of Artist and Artwork entities.

For the complete list of model properties check the Logosphere Modellingarrow-up-right documentation.

Modify libs/art-gen/src/art.model.ts file:

/* eslint-disable @typescript-eslint/no-unused-vars */
import { Entity, Prop } from '@logosphere/decorators';

@Ent('artist')
export class Artist {
  @Prop({
    examples: ['Beeple', '3LAU', 'WhisBe'],
  })
  name: string;
}

@Ent('artwork')
export class Artwork {

  @Prop({
    examples: ['The First 5000 Days', 'All Night Long', 'Gold Gummy Bear'],
  })
  title: string;

  @Prop({
    examples: ['Most famous Beeples work', 'Best work', 'It is about a gold gummy bear'],
  })
  description: string;

  @Prop({ type: () => Artist, index: false })
  author: Artist;

}

Generate art module API

Build & test art module API

Re-generate docker-compose and .env

To add Art application to existing stack, docker-compose generator need to be called again.

circle-info

Existing .env and docker-compose.yaml will be overridden. If you made some changes in previous set you have to configure it again

Run up the art service

Similar like before the service can be run as part of stack

Or can be serve as standalone container

Test API endpoint

Go to http://localhost:3001/graphqlarrow-up-right

Check schema that it matches the art module

Create an artwork

Mutation:

Variables:

Output:

Last updated