Skip to content

Commit

Permalink
feat: upda
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangtao25 committed Sep 9, 2023
1 parent 7b3b731 commit 1d2366d
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 17 deletions.
2 changes: 2 additions & 0 deletions packages/app-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@
"axios": "^1.5.0",
"canyon-util": "^0.1.3",
"cookie": "^0.5.0",
"dayjs": "^1.11.9",
"express": "^4.18.2",
"graphql": "^16.8.0",
"graphql-query-complexity": "^0.12.0",
"graphql-subscriptions": "^2.0.0",
"luxon": "^3.4.2",
"mockjs": "^1.1.0",
"mongoose": "^7.5.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/app-backend/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ type Query {

"""获取单个日历"""
getCalendar(
"""日历ID"""
calendarID: ID!
"""日期"""
date: String!
): Calendar!

"""获取所有应用列表"""
Expand Down
10 changes: 5 additions & 5 deletions packages/app-backend/src/calendar/calendar.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ export class CalendarResolver {
})
getCalendar(
@Args({
name: 'calendarID',
type: () => ID,
description: '日历ID',
name: 'date',
type: () => String,
description: '日期',
})
calendarID: string,
date: string,
): Promise<Calendar> {
return this.calendarService.getCalendar(Number(calendarID));
return this.calendarService.getCalendar(date);
}

// Mutation
Expand Down
6 changes: 4 additions & 2 deletions packages/app-backend/src/calendar/calendar.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Injectable } from '@nestjs/common';
import { PrismaService } from 'src/prisma/prisma.service';
import { PubSubService } from 'src/pubsub/pubsub.service';
import { Calendar } from './calendar.model';
// import * as Mock from 'mockjs';
// import * as dayjs from 'dayjs';
@Injectable()
export class CalendarService {
constructor(
Expand All @@ -12,10 +14,10 @@ export class CalendarService {
return this.prisma.calendar.findMany({});
}

async getCalendar(calendarID): Promise<Calendar> {
async getCalendar(date: string): Promise<Calendar> {
return this.prisma.calendar.findFirst({
where: {
id: calendarID,
date: date,
},
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/app-ui/src/helpers/backend/gen/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const documents = {
"mutation UpdateCalendar($calendarID: ID!, $proposal: String!, $content: String!, $from: String!, $profession: String!, $author: String!, $authorOriginName: String!, $date: String!, $background: String!) {\n updateCalendar(\n calendarID: $calendarID\n proposal: $proposal\n content: $content\n from: $from\n profession: $profession\n author: $author\n authorOriginName: $authorOriginName\n date: $date\n background: $background\n ) {\n id\n proposal\n content\n from\n profession\n author\n authorOriginName\n date\n background\n }\n}": types.UpdateCalendarDocument,
"query GetApplication($applicationID: ID!) {\n getApplication(applicationID: $applicationID) {\n id\n chinesename\n englishname\n organizationid\n productlineid\n productid\n category\n status\n owner\n admins\n container\n importance\n importancelevel\n }\n}": types.GetApplicationDocument,
"query GetApplications {\n listApplications {\n id\n chinesename\n englishname\n organizationid\n productlineid\n productid\n category\n status\n owner\n admins\n container\n importance\n importancelevel\n }\n}": types.GetApplicationsDocument,
"query GetCalendar($calendarID: ID!) {\n getCalendar(calendarID: $calendarID) {\n id\n proposal\n content\n from\n profession\n author\n authorOriginName\n date\n background\n }\n}": types.GetCalendarDocument,
"query GetCalendar($date: String!) {\n getCalendar(date: $date) {\n id\n proposal\n content\n from\n profession\n author\n authorOriginName\n date\n background\n }\n}": types.GetCalendarDocument,
"query GetCalendars {\n listCalendars {\n id\n proposal\n content\n from\n profession\n author\n authorOriginName\n date\n background\n }\n}": types.GetCalendarsDocument,
"query GetCoverageBaseInfo($repoId: ID!, $commitSha: String!) {\n coverageBaseInfo(repoID: $repoId, commitSha: $commitSha) {\n repoName\n commitMessage\n lastReportAvatar\n lastReportUsername\n reportIds\n lastTimeReport\n }\n}": types.GetCoverageBaseInfoDocument,
"query GetCoverageData($repoID: ID!, $commitSha: String!, $reportID: String!, $filepath: String!) {\n getCoverageData(\n repoID: $repoID\n commitSha: $commitSha\n reportID: $reportID\n filepath: $filepath\n )\n}": types.GetCoverageDataDocument,
Expand Down Expand Up @@ -73,7 +73,7 @@ export function graphql(source: "query GetApplications {\n listApplications {\n
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "query GetCalendar($calendarID: ID!) {\n getCalendar(calendarID: $calendarID) {\n id\n proposal\n content\n from\n profession\n author\n authorOriginName\n date\n background\n }\n}"): (typeof documents)["query GetCalendar($calendarID: ID!) {\n getCalendar(calendarID: $calendarID) {\n id\n proposal\n content\n from\n profession\n author\n authorOriginName\n date\n background\n }\n}"];
export function graphql(source: "query GetCalendar($date: String!) {\n getCalendar(date: $date) {\n id\n proposal\n content\n from\n profession\n author\n authorOriginName\n date\n background\n }\n}"): (typeof documents)["query GetCalendar($date: String!) {\n getCalendar(date: $date) {\n id\n proposal\n content\n from\n profession\n author\n authorOriginName\n date\n background\n }\n}"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
Loading

0 comments on commit 1d2366d

Please sign in to comment.