---
# System prepended metadata

title: GD2021

---

# GD2021

## Graphql

#### 輪播圖

```graphql=
extend type Query {
    homePhotos(type: HomePhotoType @whereLike(key: "type")): [HomePhoto!]! @all
}

type HomePhoto {
    id: ID!
    type: String
    url: String
    photo: String
}

enum HomePhotoType{
    HOME @enum(value: "home_img")
    ADVERTISING @enum(value: "show_img")
    PROVIDER @enum(value: "provider_img")
    CONSULTANT @enum(value: "consultant_img")
}

```

#### 標籤

```graphql=
extend type Query {
    tags(tagType: TagType! @eq(key: "tag_type")): [Tag!]! @all
}

type Tag {
    id: ID!
    name: String
    icon: String
}

enum TagType{
    NEWS @enum(value: "news")
    EVENT @enum(value: "event")
    MATCHING @enum(value: "matching")
    DOWNLOAD @enum(value: "download")
}

```

#### 知識補給

```graphql=
extend type Query {
    newsList(tag: String @whereTag): [News!]! @all(scopes: ["published", "ordered"])
    news(id: ID! @eq): News @find(scopes: ["published"])
    topNews: [News] @all(scopes: ["topped"])
}

type News {
    id: ID!
    date: DateTimeUtc
    title: String
    subtitle: String
    author: String
    authorInfo: String @rename(attribute: "author_info")
    content: String
    onlineDate: DateTimeUtc @rename(attribute: "online_date")
    offlineDate: DateTimeUtc @rename(attribute: "offline_date")
    authorImg: String @rename(attribute: "author_img")
    allTags: [String] @rename(attribute: "all_tags")
    userinfo: Userinfo @belongsTo
    docs: [Doc] @morphMany
}

type Doc {
    id: ID!
    url: String
    fileName: String @rename(attribute: "file_name")
}

```

#### 數位學習

```graphql=
extend type Query {
    events(
        type: EventType @eq(key: "type"),
        tag: String @whereTag,
        keyword: String @whereLike(key: "title")
        startDateBetween: DateRange @whereBetween(key:"start_date")
    ): [Eventt!]! @all(scopes:["ordered"])
    event(id: ID! @eq): Eventt @find
}

type Eventt {
    id: ID!
    type: String
    title: String
    youtubeId: String
    startDate: DateTimeUtc @rename(attribute: "start_date")
    endDate: DateTimeUtc @rename(attribute: "end_date")
    onlineDate: DateTimeUtc @rename(attribute: "online_date")
    offlineDate: DateTimeUtc @rename(attribute: "offline_date")
    location: String
    organizer: String
    price: Int
    quota: Int
    applicants: Int
    description: String
    eventUrl: String @rename(attribute: "event_url")
    image: String 
    mainTag: Tag @belongsTo
    tags: [Tag] @belongsToMany
}

enum EventType{
    ONLINE @enum(value: "online")
    RAISE @enum(value: "raise")
    COURSE @enum(value: "course")
}

```

#### 新知脈動
``` graphql=
extend type Query {
	popularNews: [Trend] @all(scopes: ["popular"])
	latestNews: [Trend] @all(scopes: ["latest"])
	recommendedNews: [Trend] @all(scopes: ["recommend"])
}

type Trend {
	id: ID!
	type: String
	news: News @belongsTo
}
```

#### 使用者

``` graphql=
type Query {
    users: [User!]! @all
    user(id: ID @eq): User @find
}

type User {
    id: ID!
    name: String!
    email: String
    type: String
    identityId: String @rename(attribute: "identity_id")
    createdAt: DateTimeUtc @rename(attribute: "created_at")
    updatedAt: DateTimeUtc @rename(attribute: "updated_at")
    userinfo: Userinfo @hasOne
}

type Userinfo {
    id: ID!
    services: [String]
    mainTag: Tag @belongsTo
    name: String
    present: String
    facebook: String
    weibo: String
    website: String
    phone: String
    address: String
    introduction: String
    education: String
    experience: String
    article: String
    city: String
    businessNo: String @rename(attribute: "business_no")
    contact1: String
    contactEmail1: String @rename(attribute: "contact_email1")
    contactPhone1: String @rename(attribute: "contact_phone1")
    contact2: String
    contactEmail2: String @rename(attribute: "contact_email2")
    contactPhone2: String @rename(attribute: "contact_phone2")
    userImg: String
    listImg: String
    tags: [Tag] @belongsToMany
    portfolios: [Portfolio] @hasMany(scopes:["ordered"])
    recommendations: [Userinfo]
}

type Portfolio {
    description: String
    photo: String
}
```

#### 電商輔導

``` graphql=
extend type Query {
    providers(
    	tagIds: [String] @whereHasTags,
    	keyword: String @whereLike(key: "name")
    ): [Userinfo] @all(scopes: ["provider", "onlined"])
    consultants(
    	tagIds: [String] @whereHasTags,
    	keyword: String @whereLike(key: "name")
    ): [Userinfo] @all(scopes: ["consultant", "onlined"])
    provider(id: ID! @eq): Userinfo @find(scopes: ["provider", "onlined"])
    consultant(id: ID! @eq): Userinfo @find(scopes: ["consultant", "onlined"])
}
```

#### 檔案下載

``` graphql=
extend type Query {
    downloads(
    	tagId: String @eq(key: "tag_id"),
    	keyword: String @whereLike(key: "name")
    ): [Download!]! @all
}

type Download {
    id: ID!
    title: String
    date: DateTimeUtc
    doc: Doc @morphOne
    tag: Tag @belongsTo
}
```

#### 成功案例

``` graphql=
extend type Query {
    successCases: [SuccessCase!]! @all(scopes: ["published"])
    successCase(id: ID! @eq): SuccessCase @find(scopes: ["published"])
}

type SuccessCase {
    id: ID!
    title: String
    description: String
    companyName: String @rename(attribute: "company_name")
    picture: String
}
```

#### 商情資訊

``` graphql=
extend type Query {
    businesses: [Business!]! @all(scopes: ["published"])
    business(id: ID! @eq): Business @find(scopes: ["published"])
}

type Business {
    id: ID!
    title: String
    content: String
    date: DateTimeUtc
}
```

#### 募集活動申請

```graphql=
extend type Mutation {
  	eventApplication(input: EventApplicationInput! @spread): Boolean @field(resolver: "App\\GraphQL\\Mutations\\EventApplication")
}

input EventApplicationInput {
    name: String 
    email: String
    phone: String
    company: String
    businessNo: String
    eventId: String
}

```

#### 點擊數

``` graphql=
extend type Mutation {
    click(input: ClickInput! @spread): Boolean @field(resolver: "App\\GraphQL\\Mutations\\Click")
}

input ClickInput {
    clickableId: String,
	clickableType: ClickableType,
	category: CategoryEnum,
}

enum ClickableType{
    EVENT @enum(value: "App\\Eventt")
    NEWS @enum(value: "App\\News")
    USER @enum(value: "App\\Userinfo")
}

enum CategoryEnum{
    CLICKS @enum(value: "clicks")
    FACEBOOK @enum(value: "facebook")
    LINE @enum(value: "line")
}

```

#### 熱搜

``` graphql=
type Query {
    keywords(type: KeywordType @eq): [Keyword] @all(scopes: ["ordered"])
}

extend type Mutation {
    searchedKeyword(input: SearchedKeywordInput! @spread): Boolean @field(resolver: "App\\GraphQL\\Mutations\\SearchedKeyword")
}

input SearchedKeywordInput {
    type: KeywordType,
	name: String,
}

enum KeywordType{
    EVENT @enum(value: "App\\Eventt")
    USER @enum(value: "App\\Userinfo")
}

type Keyword {
    id: ID!
    name: String
}

```

#### 寄送詢問單

``` graphql=
extend type Mutation {
    inquiryForm(input: InquiryFormInput! @spread): Boolean @field(resolver: "App\\GraphQL\\Mutations\\InquiryForm")
}

input InquiryFormInput {
    inquiryCategory: String,
    content: String,
    userinfoId: String,
    company: String,
    taxId: String,
    name: String,
    email: String,
    phone: String,
    industry: String
}
```
