Skip to content

Commit

Permalink
Merge pull request #470 from codeforjapan/development
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
NEKOYASAN authored Oct 16, 2020
2 parents 2d8aaf0 + 554e12b commit 35ffae4
Show file tree
Hide file tree
Showing 6 changed files with 1,297 additions and 971 deletions.
11 changes: 1 addition & 10 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export default {
['@nuxtjs/dotenv', { filename: `.env.${environment}` }],
'nuxt-svg-loader',
['nuxt-i18n', i18nConfig],
['@nuxtjs/google-analytics', { id: process.env.GAID }],
],
/*
** Axios module configuration
Expand All @@ -132,16 +133,6 @@ export default {
families: ['Roboto&display=swap', 'NotoSansJP&&display=swap'],
},
},
env: {
APIKEY: process.env.APIKEY,
AUTHDOMAIN: process.env.AUTHDOMAIN,
DATABASEURL: process.env.DATABASEURL,
PROJECTID: process.env.PROJECTID,
STORAGEBUCKET: process.env.STORAGEBUCKET,
MESSAGINGSENDERID: process.env.MESSAGINGSENDERID,
APPID: process.env.APPID,
MEASUREMENTID: process.env.MEASUREMENTID,
},
manifest: {
name: 'おうちで時間割',
short_name: 'おうちで時間割',
Expand Down
40 changes: 20 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,65 +24,65 @@
}
},
"dependencies": {
"@aws-amplify/api": "^3.2.6",
"@babel/core": "^7.11.6",
"@babel/runtime-corejs3": "^7.11.2",
"@aws-amplify/api": "^3.2.7",
"@babel/core": "^7.12.1",
"@babel/runtime-corejs3": "^7.12.1",
"@nuxt/typescript-runtime": "^2.0.0",
"@nuxtjs/axios": "^5.12.2",
"@nuxtjs/dotenv": "^1.4.1",
"@nuxtjs/pwa": "^3.0.2",
"@nuxtjs/google-analytics": "^2.4.0",
"@nuxtjs/pwa": "^3.2.2",
"@nuxtjs/style-resources": "^1.0.0",
"@types/node": "^14.11.2",
"aws-amplify": "^3.3.3",
"cookieparser": "^0.1.0",
"core-js": "3.6.5",
"@types/node": "^14.11.8",
"aws-amplify": "^3.3.4",
"core-js": "^3.6.5",
"cross-env": "^7.0.2",
"date-fns": "^2.16.1",
"dayjs": "^1.9.1",
"dayjs": "^1.9.3",
"express": "^4.17.1",
"nuxt": "^2.14.6",
"nuxt-i18n": "^6.15.1",
"nuxt": "^2.14.7",
"nuxt-i18n": "^6.15.3",
"nuxt-property-decorator": "^2.8.8",
"nuxt-svg-loader": "^1.2.0",
"nuxt-webfontloader": "^1.1.0",
"uuid": "^8.3.1",
"vue-property-decorator": "^9.0.2",
"vuetify": "^2.3.13",
"vuetify": "^2.3.14",
"vuex": "^3.5.1",
"vuex-class-component": "^2.3.5"
},
"devDependencies": {
"@mdi/font": "^5.6.55",
"@nuxt/types": "^2.14.6",
"@mdi/font": "^5.7.55",
"@nuxt/types": "^2.14.7",
"@nuxt/typescript-build": "^2.0.3",
"@nuxtjs/eslint-config-typescript": "^3.0.0",
"@nuxtjs/stylelint-module": "^4.0.0",
"@types/jest": "^26.0.14",
"@vue/test-utils": "^1.1.0",
"babel-core": "^6.26.3",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.3.0",
"babel-jest": "^26.5.2",
"cpx": "^1.5.0",
"eslint": "^7.10.0",
"eslint": "^7.11.0",
"eslint-config-prettier": "^6.12.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-nuxt": "^1.0.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-tsdoc": "^0.2.7",
"husky": "^4.3.0",
"jest": "^26.4.2",
"jest": "^26.5.3",
"lint-staged": "^10.4.0",
"node-sass": "^4.14.1",
"nodemon": "^2.0.4",
"nodemon": "^2.0.5",
"prettier": "^2.1.2",
"rimraf": "^3.0.2",
"sass-loader": "^10.0.3",
"stylelint": "^13.7.1",
"stylelint": "^13.7.2",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.18.0",
"ts-jest": "^26.4.1",
"ts-loader": "^8.0.4",
"ts-loader": "^8.0.5",
"vue": "^2.6.12",
"vue-jest": "^3.0.7",
"vue-server-renderer": "^2.6.12",
Expand Down
30 changes: 24 additions & 6 deletions src/pages/user/classlist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@
import Vue from 'vue'
import BaseBottomSheetLayer from '@/components/BaseBottomSheetLayer.vue'
import BaseActionButton from '@/components/BaseActionButton.vue'
import { Auth, API, graphqlOperation } from 'aws-amplify'
import { Auth, API } from 'aws-amplify'
import { GraphQLResult } from '@aws-amplify/api'
import { vxm } from '@/store'
import { listClasss } from '@/graphql/queries'
import { ListClasssQuery } from '@/API'
type DataType = {
Expand All @@ -77,11 +76,30 @@ export default Vue.extend({
},
async created() {
const user = await Auth.currentAuthenticatedUser()
const result = (await API.graphql(
graphqlOperation(listClasss, {
const listClasssSimple = /* GraphQL */ `
query ListClasss(
$filter: ModelClassFilterInput
$limit: Int
$nextToken: String
) {
listClasss(filter: $filter, limit: $limit, nextToken: $nextToken) {
items {
id
school {
name
}
className
}
nextToken
}
}
`
const result = (await API.graphql({
query: listClasssSimple,
variables: {
filter: { owner: { eq: user.username } },
})
)) as GraphQLResult<ListClasssQuery>
},
})) as GraphQLResult<ListClasssQuery>
this.items = (result?.data?.listClasss?.items as any[]).map((item) => {
return {
classId: item.id,
Expand Down
86 changes: 73 additions & 13 deletions src/store/modules/classData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { AppStore } from '@/store/modules/app'
import classData from '@/types/store/classData'
import { API, Auth, graphqlOperation } from 'aws-amplify'
import { GRAPHQL_AUTH_MODE, GraphQLResult } from '@aws-amplify/api'
import { getClass, listLessonsByClass } from '@/graphql/queries'
import {
createSchool,
createClass,
Expand All @@ -22,6 +21,60 @@ type LessonsGroupedBy = {
[key: string]: classData.LessonWithId[]
}

const getClassSimple = /* GraphQL */ `
query GetClass($id: ID!) {
getClass(id: $id) {
id
className
}
}
`

const listLessonsByClassSimple = /* GraphQL */ `
query ListLessonsByClass(
$classId: ID
$startTime: ModelStringKeyConditionInput
$sortDirection: ModelSortDirection
$filter: ModelLessonFilterInput
$limit: Int
$nextToken: String
) {
listLessonsByClass(
classId: $classId
startTime: $startTime
sortDirection: $sortDirection
filter: $filter
limit: $limit
nextToken: $nextToken
) {
items {
id
startTime
endTime
title
subject {
name
color
}
goal
description
videos {
title
url
thumbnailUrl
}
pages
materials {
title
url
}
isHidden
}
nextToken
}
}
`

const VuexModule = createModule({
namespaced: 'classData',
strict: false,
Expand All @@ -42,17 +95,24 @@ const generateUniqueId = (): string => {
return result + ''
}
// Generate a new Date object with a specified date & time
const d = (date: Date, hours: number, minutes: number, seconds: number) => {
const d = (
date: Date,
hours: number,
minutes: number,
seconds: number,
milliseconds: number
) => {
const newDate = new Date(date)
newDate.setHours(hours)
newDate.setMinutes(minutes)
newDate.setSeconds(seconds)
newDate.setMilliseconds(milliseconds)
return newDate
}

const getFullDayArray = (date: Date) => {
const start = d(date, 0, 0, 0)
const end = d(date, 24, 0, 0)
const start = d(date, 0, 0, 0, 0)
const end = d(date, 24, 0, 0, 0)
return [start, end]
}

Expand All @@ -64,7 +124,7 @@ export class ClassDataStore extends VuexModule implements classData.ClassData {
@action
public async lessonsOnCurrentDate(date: Date) {
const lessons = (await API.graphql({
query: listLessonsByClass,
query: listLessonsByClassSimple,
variables: {
classId: this.classId,
startTime: {
Expand Down Expand Up @@ -156,9 +216,10 @@ export class ClassDataStore extends VuexModule implements classData.ClassData {

@action
public async loadClassData(classId: classData.ClassId) {
const result = (await API.graphql(
graphqlOperation(getClass, { id: classId })
)) as GraphQLResult<GetClassQuery>
const result = (await API.graphql({
query: getClassSimple,
variables: { id: classId },
})) as GraphQLResult<GetClassQuery>

const classObject = result?.data?.getClass
if (!classObject) {
Expand Down Expand Up @@ -188,11 +249,10 @@ export class ClassDataStore extends VuexModule implements classData.ClassData {
do {
classId = generateUniqueId()
try {
const result = (await API.graphql(
graphqlOperation(getClass, {
id: classId,
})
)) as GraphQLResult<GetClassQuery>
const result = (await API.graphql({
query: getClassSimple,
variables: { id: classId },
})) as GraphQLResult<GetClassQuery>
classObject = result?.data?.getClass
} catch {
throw new Error('エラーによって処理に失敗しました')
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"types": [
"@types/node",
"@nuxt/types",
"@types/js-cookie",
"@types/jest",
"vuetify",
"nuxt-i18n"
Expand Down
Loading

0 comments on commit 35ffae4

Please sign in to comment.