-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
475 additions
and
488 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package app | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/acoshift/acourse/entity" | ||
) | ||
|
||
// PublicCourse type | ||
type PublicCourse struct { | ||
ID string | ||
Option entity.CourseOption | ||
Title string | ||
Desc string | ||
Image string | ||
Start time.Time | ||
URL string | ||
Type int | ||
Price float64 | ||
Discount float64 | ||
} | ||
|
||
// Link returns course link | ||
func (x *PublicCourse) Link() string { | ||
if x.URL != "" { | ||
return x.URL | ||
} | ||
return x.ID | ||
} | ||
|
||
// ShowStart returns true if course should show start date | ||
func (x *PublicCourse) ShowStart() bool { | ||
return x.Type == entity.Live && !x.Start.IsZero() | ||
} | ||
|
||
// EnrolledCourse type | ||
type EnrolledCourse struct { | ||
ID string | ||
Title string | ||
Desc string | ||
Image string | ||
Start time.Time | ||
URL string | ||
Type int | ||
} | ||
|
||
// Link returns course link | ||
func (x *EnrolledCourse) Link() string { | ||
if x.URL != "" { | ||
return x.URL | ||
} | ||
return x.ID | ||
} | ||
|
||
// ShowStart returns true if course should show start date | ||
func (x *EnrolledCourse) ShowStart() bool { | ||
return x.Type == entity.Live && !x.Start.IsZero() | ||
} | ||
|
||
// OwnCourse type | ||
type OwnCourse struct { | ||
ID string | ||
Title string | ||
Desc string | ||
Image string | ||
Start time.Time | ||
URL string | ||
Type int | ||
EnrollCount int | ||
} | ||
|
||
// Link returns course link | ||
func (x *OwnCourse) Link() string { | ||
if x.URL != "" { | ||
return x.URL | ||
} | ||
return x.ID | ||
} | ||
|
||
// ShowStart returns true if course should show start date | ||
func (x *OwnCourse) ShowStart() bool { | ||
return x.Type == entity.Live && !x.Start.IsZero() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package editor | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/acoshift/acourse/entity" | ||
) | ||
|
||
// Repository is editor storage | ||
type Repository interface { | ||
GetCourse(ctx context.Context, courseID string) (*entity.Course, error) | ||
GetCourseUserID(ctx context.Context, courseID string) (string, error) | ||
GetCourseURL(ctx context.Context, courseID string) (string, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.