#11 - Update Courses with new Types
This commit is contained in:
parent
989a0dbb50
commit
f6d933ddd2
@ -46,11 +46,11 @@ const { course }: Props = Astro.props;
|
||||
<h3>Incluido en Carreras:</h3>
|
||||
</div>
|
||||
<div class="d-flex gap-2 mt-3">
|
||||
{course.codyops_careers.map((carrer: any) => (
|
||||
<a class="btn btn-outline-success mb-1" href={`/carreras/${carrer.codyops_careers_id.slug}/`}>
|
||||
{carrer.codyops_careers_id.name}
|
||||
{course.codyops_careers.map((career: any) => (
|
||||
<a class="btn btn-outline-success mb-1" href={`/carreras/${career.codyops_careers_id.slug}/`}>
|
||||
{career.codyops_careers_id.name}
|
||||
</a>
|
||||
))}
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
@ -70,4 +70,4 @@ const { course }: Props = Astro.props;
|
||||
p {
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@ -1,14 +1,37 @@
|
||||
import directus from "./directus";
|
||||
import { readItems } from "@directus/sdk";
|
||||
import { readItems, type Query } from "@directus/sdk";
|
||||
import type { CodyopsCourses, Courses } from "../types/codyops-courses";
|
||||
|
||||
export const courses = await directus.request(
|
||||
readItems("codyops_courses", {
|
||||
readItems<CodyopsCourses, 'codyops_courses', Query<CodyopsCourses, Courses>>("codyops_courses", {
|
||||
fields: [
|
||||
'*',
|
||||
'user_created.*',
|
||||
'modules.*',
|
||||
'codyops_careers.codyops_careers_id.name',
|
||||
'codyops_careers.codyops_careers_id.slug',
|
||||
{
|
||||
codyops_careers: [
|
||||
{
|
||||
codyops_careers_id: [
|
||||
'name',
|
||||
'slug'
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
user_created: [
|
||||
'first_name',
|
||||
'last_name',
|
||||
'avatar',
|
||||
'url'
|
||||
]
|
||||
},
|
||||
{
|
||||
modules: [
|
||||
'duration',
|
||||
'title',
|
||||
'description',
|
||||
'video'
|
||||
]
|
||||
}
|
||||
]}
|
||||
)
|
||||
);
|
||||
@ -30,4 +53,3 @@ export function filterCoursesByCategory(courses: any, category: any) {
|
||||
export function filterCoursesByCloud(courses: any, clouds: string[]) {
|
||||
return courses.filter((course: any) => course.cloud?.includes(clouds));
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user