src/schema/*: explicit time for loanPeriod

instead of an array, all day of the week are listed and their type is
string for simplicity incase of several time frames in a day.
pull/25/head
leonnicolas 4 years ago
parent 48e6ed2be3
commit 49bc8bdcfc
No known key found for this signature in database
GPG Key ID: 088D0743E2B65C07

@ -44,10 +44,39 @@ export class LoanPeriod {
to: Date; to: Date;
@Column({ @Column({
type: 'simple-array',
nullable: true nullable: true
}) })
loanTimes: string[]; mo: string;
@Column({
nullable: true
})
tu: string;
@Column({
nullable: true
})
we: string;
@Column({
nullable: true
})
th: string;
@Column({
nullable: true
})
fr: string;
@Column({
nullable: true
})
sa: string;
@Column({
nullable: true
})
su: string;
} }
@Entity() @Entity()

@ -99,11 +99,6 @@ export default {
isLockedByMe: (parent: any, __: any, { req }: { req: any }) => isLockedByMe(parent, { req }), isLockedByMe: (parent: any, __: any, { req }: { req: any }) => isLockedByMe(parent, { req }),
isLocked: (parent: any, __: any, { req }: { req: any }) => isLocked(parent, { req }) isLocked: (parent: any, __: any, { req }: { req: any }) => isLocked(parent, { req })
}, },
LoanPeriod: {
loanTimes (parent: any) {
return parent.loanTimes ? parent.loanTimes : [];
}
},
DateRange: { DateRange: {
from (parent: string) { from (parent: string) {
return parent.replace(/^\[(.*),.*\)$/, '$1'); return parent.replace(/^\[(.*),.*\)$/, '$1');

@ -21,8 +21,10 @@ import { gql } from 'apollo-server-express';
export default gql` export default gql`
"timestamp object YYYY-MM-ddThh:mm:ss.sssZ" "date object YYYY-MM-dd"
scalar Date scalar Date
"timestamp object YYYY-MM-ddThh:mm:ss.sssZ"
scalar DateTime
"only time hh-mm-ss" "only time hh-mm-ss"
scalar Time scalar Time
""" """
@ -82,7 +84,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
""" """
@ -429,7 +431,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input ParticipantCreateInput { input ParticipantCreateInput {
@ -482,7 +484,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input WorkshopCreateInput { input WorkshopCreateInput {
@ -512,7 +514,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input WorkshopTypeCreateInput { input WorkshopTypeCreateInput {
@ -532,7 +534,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input EngagementTypeCreateInput { input EngagementTypeCreateInput {
@ -557,7 +559,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input EngagementCreateInput { input EngagementCreateInput {
@ -609,7 +611,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input EquipmentCreateInput { input EquipmentCreateInput {
@ -641,7 +643,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input EquipmentTypeCreateInput { input EquipmentTypeCreateInput {
@ -674,7 +676,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input BikeEventCreateInput { input BikeEventCreateInput {
@ -714,7 +716,7 @@ export default gql`
isLocked: Boolean! isLocked: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input BikeEventTypeUpdateInput { input BikeEventTypeUpdateInput {
@ -734,7 +736,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
"(dt. Anbieter)" "(dt. Anbieter)"
@ -768,7 +770,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input PersonCreateInput { input PersonCreateInput {
@ -795,7 +797,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input ContactInformationCreateInput { input ContactInformationCreateInput {
@ -835,7 +837,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input OrganisationCreateInput { input OrganisationCreateInput {
@ -879,7 +881,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
""" """
@ -913,13 +915,13 @@ export default gql`
""" """
type LoanPeriod { type LoanPeriod {
generalRemark: String generalRemark: String
"notes for each day of the week, starting on Monday" mo: String
notes: [String] tu: String
""" we: String
Loan times from and until for each day of the week. th: String
Starting with Monday from, Monday to, Tuesday from, ..., Sunday to fr: String
""" sa: String
loanTimes: [String] su: String
} }
""" """
@ -927,13 +929,13 @@ export default gql`
""" """
input LoanPeriodInput { input LoanPeriodInput {
generalRemark: String generalRemark: String
"notes for each day of the week, starting on Monday" mo: String
notes: [String!] tu: String
""" we: String
Loan times from and until for each day of the week. th: String
Starting with Monday from, Monday to, Tuesday from, ..., Sunday to fr: String
""" sa: String
loanTimes: [String!] su: String
} }
type DateRange{ type DateRange{
@ -963,7 +965,7 @@ export default gql`
isLockedByMe: Boolean! isLockedByMe: Boolean!
"null if not locked by other user" "null if not locked by other user"
lockedBy: ID lockedBy: ID
lockedUntil: Date lockedUntil: DateTime
} }
input TimeFrameCreateInput { input TimeFrameCreateInput {

Loading…
Cancel
Save