Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
update models
Browse files Browse the repository at this point in the history
  • Loading branch information
katiegoines committed Jul 10, 2024
1 parent d575a40 commit 5fb953f
Show file tree
Hide file tree
Showing 3 changed files with 346 additions and 211 deletions.
184 changes: 146 additions & 38 deletions src/models/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ModelInit, MutableModel, PersistentModelConstructor } from "@aws-amplify/datastore";
import { ModelInit, MutableModel } from "@aws-amplify/datastore";
// @ts-ignore
import { LazyLoading, LazyLoadingDisabled, AsyncCollection, AsyncItem } from "@aws-amplify/datastore";

export enum SocialMediaPlatform {
INSTAGRAM = "INSTAGRAM",
Expand All @@ -17,43 +19,51 @@ export enum SkillLevel {
ADVANCED = "ADVANCED"
}

export declare class SocialMediaLink {
type EagerSocialMediaLink = {
readonly platform: SocialMediaPlatform | keyof typeof SocialMediaPlatform;
readonly url: string;
constructor(init: ModelInit<SocialMediaLink>);
}

export declare class Tag {
type LazySocialMediaLink = {
readonly platform: SocialMediaPlatform | keyof typeof SocialMediaPlatform;
readonly url: string;
}

export declare type SocialMediaLink = LazyLoading extends LazyLoadingDisabled ? EagerSocialMediaLink : LazySocialMediaLink

export declare const SocialMediaLink: (new (init: ModelInit<SocialMediaLink>) => SocialMediaLink)













type EagerTag = {
readonly id: string;
readonly name: string;
readonly courses?: (CourseTag | null)[] | null;
constructor(init: ModelInit<Tag>);
static copyOf(source: Tag, mutator: (draft: MutableModel<Tag>) => MutableModel<Tag> | void): Tag;
}

export declare class Course {
type LazyTag = {
readonly id: string;
readonly title: string;
readonly timeHours: number;
readonly timeMinutes: number;
readonly learningObjective: string;
readonly description: string;
readonly requirements?: string[] | null;
readonly image: string;
readonly contributors?: (ContributorCourse | null)[] | null;
readonly courseTags?: (CourseTag | null)[] | null;
readonly skillLevel: SkillLevel | keyof typeof SkillLevel;
readonly dateCreated: string;
readonly isFeatured: boolean;
readonly imageAltText?: string | null;
readonly trailerEmbedId?: string | null;
readonly courseUrlTitle: string;
readonly published?: boolean | null;
constructor(init: ModelInit<Course>);
static copyOf(source: Course, mutator: (draft: MutableModel<Course>) => MutableModel<Course> | void): Course;
readonly name: string;
readonly courses: AsyncCollection<CourseTag>;
}

export declare type Tag = LazyLoading extends LazyLoadingDisabled ? EagerTag : LazyTag

export declare const Tag: (new (init: ModelInit<Tag>) => Tag) & {
copyOf(source: Tag, mutator: (draft: MutableModel<Tag>) => MutableModel<Tag> | void): Tag;
}

export declare class Contributor {
type EagerContributor = {
readonly id: string;
readonly jobTitle: string;
readonly socialNetwork?: (SocialMediaLink | null)[] | null;
Expand All @@ -63,11 +73,27 @@ export declare class Contributor {
readonly username: string;
readonly lastName: string;
readonly firstName: string;
constructor(init: ModelInit<Contributor>);
static copyOf(source: Contributor, mutator: (draft: MutableModel<Contributor>) => MutableModel<Contributor> | void): Contributor;
}

export declare class Lesson {
type LazyContributor = {
readonly id: string;
readonly jobTitle: string;
readonly socialNetwork?: (SocialMediaLink | null)[] | null;
readonly courses: AsyncCollection<ContributorCourse>;
readonly bio: string;
readonly profilePic: string;
readonly username: string;
readonly lastName: string;
readonly firstName: string;
}

export declare type Contributor = LazyLoading extends LazyLoadingDisabled ? EagerContributor : LazyContributor

export declare const Contributor: (new (init: ModelInit<Contributor>) => Contributor) & {
copyOf(source: Contributor, mutator: (draft: MutableModel<Contributor>) => MutableModel<Contributor> | void): Contributor;
}

type EagerLesson = {
readonly id: string;
readonly title: string;
readonly content: string;
Expand All @@ -77,22 +103,104 @@ export declare class Lesson {
readonly lessonNumber: number;
readonly description: string;
readonly lessonCourseLessonId?: string | null;
constructor(init: ModelInit<Lesson>);
static copyOf(source: Lesson, mutator: (draft: MutableModel<Lesson>) => MutableModel<Lesson> | void): Lesson;
}

export declare class CourseTag {
type LazyLesson = {
readonly id: string;
readonly title: string;
readonly content: string;
readonly youtubeEmbedId?: string | null;
readonly chapter: number;
readonly courseLesson: AsyncItem<Course | undefined>;
readonly lessonNumber: number;
readonly description: string;
readonly lessonCourseLessonId?: string | null;
}

export declare type Lesson = LazyLoading extends LazyLoadingDisabled ? EagerLesson : LazyLesson

export declare const Lesson: (new (init: ModelInit<Lesson>) => Lesson) & {
copyOf(source: Lesson, mutator: (draft: MutableModel<Lesson>) => MutableModel<Lesson> | void): Lesson;
}

type EagerCourse = {
readonly id: string;
readonly title: string;
readonly timeHours: number;
readonly timeMinutes: number;
readonly learningObjective: string;
readonly description: string;
readonly requirements?: string[] | null;
readonly image: string;
readonly contributors?: (ContributorCourse | null)[] | null;
readonly courseTags?: (CourseTag | null)[] | null;
readonly skillLevel: SkillLevel | keyof typeof SkillLevel;
readonly dateCreated: string;
readonly isFeatured: boolean;
readonly imageAltText?: string | null;
readonly trailerEmbedId?: string | null;
readonly courseUrlTitle: string;
readonly published?: boolean | null;
}

type LazyCourse = {
readonly id: string;
readonly title: string;
readonly timeHours: number;
readonly timeMinutes: number;
readonly learningObjective: string;
readonly description: string;
readonly requirements?: string[] | null;
readonly image: string;
readonly contributors: AsyncCollection<ContributorCourse>;
readonly courseTags: AsyncCollection<CourseTag>;
readonly skillLevel: SkillLevel | keyof typeof SkillLevel;
readonly dateCreated: string;
readonly isFeatured: boolean;
readonly imageAltText?: string | null;
readonly trailerEmbedId?: string | null;
readonly courseUrlTitle: string;
readonly published?: boolean | null;
}

export declare type Course = LazyLoading extends LazyLoadingDisabled ? EagerCourse : LazyCourse

export declare const Course: (new (init: ModelInit<Course>) => Course) & {
copyOf(source: Course, mutator: (draft: MutableModel<Course>) => MutableModel<Course> | void): Course;
}

type EagerCourseTag = {
readonly id: string;
readonly tag: Tag;
readonly course: Course;
constructor(init: ModelInit<CourseTag>);
static copyOf(source: CourseTag, mutator: (draft: MutableModel<CourseTag>) => MutableModel<CourseTag> | void): CourseTag;
}

export declare class ContributorCourse {
type LazyCourseTag = {
readonly id: string;
readonly tag: AsyncItem<Tag>;
readonly course: AsyncItem<Course>;
}

export declare type CourseTag = LazyLoading extends LazyLoadingDisabled ? EagerCourseTag : LazyCourseTag

export declare const CourseTag: (new (init: ModelInit<CourseTag>) => CourseTag) & {
copyOf(source: CourseTag, mutator: (draft: MutableModel<CourseTag>) => MutableModel<CourseTag> | void): CourseTag;
}

type EagerContributorCourse = {
readonly id: string;
readonly course: Course;
readonly contributor: Contributor;
constructor(init: ModelInit<ContributorCourse>);
static copyOf(source: ContributorCourse, mutator: (draft: MutableModel<ContributorCourse>) => MutableModel<ContributorCourse> | void): ContributorCourse;
readonly course: Course;
}

type LazyContributorCourse = {
readonly id: string;
readonly contributor: AsyncItem<Contributor>;
readonly course: AsyncItem<Course>;
}

export declare type ContributorCourse = LazyLoading extends LazyLoadingDisabled ? EagerContributorCourse : LazyContributorCourse

export declare const ContributorCourse: (new (init: ModelInit<ContributorCourse>) => ContributorCourse) & {
copyOf(source: ContributorCourse, mutator: (draft: MutableModel<ContributorCourse>) => MutableModel<ContributorCourse> | void): ContributorCourse;
}
4 changes: 2 additions & 2 deletions src/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ const SkillLevel = {
"ADVANCED": "ADVANCED"
};

const { Tag, Course, Contributor, Lesson, CourseTag, ContributorCourse, SocialMediaLink } = initSchema(schema);
const { Tag, Contributor, Lesson, Course, CourseTag, ContributorCourse, SocialMediaLink } = initSchema(schema);

export {
Tag,
Course,
Contributor,
Lesson,
Course,
CourseTag,
ContributorCourse,
SocialMediaPlatform,
Expand Down
Loading

0 comments on commit 5fb953f

Please sign in to comment.