from django.core.management import BaseCommand
from django.core.management import call_command
from django.conf import settings
import json
import os


class Command(BaseCommand):
    def handle(self, *args, **options):
        from api.schema import schema
        from api.schema_public import schema as schema_public

        schema_path = os.path.join(settings.BASE_DIR, '..', 'schema.graphql')
        public_schema_path = os.path.join(settings.BASE_DIR, '..', 'schema_public.graphql')

        with open(schema_path, 'w') as o:
            o.write(str(schema))

        # with open(public_schema_path, 'w') as o:
        #     o.write(str(schema_public))

