Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release version v1.0.0-97 #2083

Merged
merged 7 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## v1.0.0-97


### 🏡 Chore

- Template assets ([0f85e43](https://github.com/undb-io/undb/commit/0f85e43))

### ❤️ Contributors

- Nichenqin ([@nichenqin](http://github.com/nichenqin))

## v1.0.0-96


Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/backend/assets/templates/hr/cover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/backend/assets/templates/hr/image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/backend/assets/templates/hr/image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/backend/assets/templates/hr/image3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/backend/assets/templates/hr/image4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/backend/assets/templates/hr/image5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
</script>

<div data-field-id={field.id.value} data-field-type={field.type} class="flex items-center justify-between gap-1">
<div class="flex items-center gap-1">
<div class="flex items-center gap-1 overflow-hidden">
<FieldIcon {field} type={field.type} class="h-4 w-4" />
<span>
<span class="truncate" title={field.name.value} data-field-name={field.name.value} data-field-id={field.id.value}>
{field.name.value}
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "undb",
"version": "1.0.0-96",
"version": "1.0.0-97",
"private": true,
"scripts": {
"build": "NODE_ENV=production bun --bun turbo build",
Expand Down
193 changes: 152 additions & 41 deletions packages/persistence/src/template/template-data.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,162 @@
import { env } from "@undb/env"
import { templates,type IBaseTemplateDTO,type ITemplateDTO } from "@undb/template"
import { templates, type IBaseTemplateDTO, type ITemplateDTO } from "@undb/template"

function getTemplateImage(folder: string, file: string) {
return env.UNDB_BASE_URL + "/assets/templates/" + folder + "/" + file
}

export const templateData: ITemplateDTO[] = [
{
id: "6ba7b815-9dad-11d1-80b4-00c04fd430c8",
icon: "👨‍👧‍👦",
name: "Human Resource Management",
categories: ["hr"],
cover: getTemplateImage("hr", "cover.jpg"),
images: [
getTemplateImage("hr", "image1.png"),
getTemplateImage("hr", "image2.png"),
getTemplateImage("hr", "image3.png"),
getTemplateImage("hr", "image4.png"),
getTemplateImage("hr", "image5.png"),
],
description: "A template for managing human resources, including employees, positions, and departments.",
detail: `
<h1>UnDB Human Resource Management Template: Streamline Your HR Processes</h1>

<h2>Comprehensive HR Management Features for Modern Businesses</h2>

<p>UnDB's Human Resource Management template offers a powerful set of tools to revolutionize your HR operations:</p>

<h3>Employee Management System</h3>
<ul>
<li>Create and maintain detailed employee profiles</li>
<li>Track positions, departments, salaries, and employment status</li>
<li>Manage organizational hierarchy with reporting structures</li>
</ul>

<h3>Department and Payroll Administration</h3>
<ul>
<li>Organize company departments with budget and location tracking</li>
<li>Administer payroll, including salaries, bonuses, and deductions</li>
<li>Automate net pay calculations for efficient processing</li>
</ul>

<h3>Leave Management and Performance Evaluation</h3>
<ul>
<li>Streamline time-off requests with customizable leave types</li>
<li>Conduct regular performance reviews with rating systems</li>
<li>Set and track employee goals for career development</li>
</ul>

<h2>Benefits of UnDB's HR Software Template</h2>

<p>Transform your human resources processes with our comprehensive solution:</p>

<ul>
<li>Centralized HR Data Management</li>
<li>Improved Operational Efficiency</li>
<li>Enhanced Organizational Visibility</li>
<li>Scalable and Customizable Platform</li>
<li>Data-Driven HR Decision Making</li>
</ul>

<h2>HR Template Structure</h2>

<p>Our HR management system includes five key components:</p>

<ol>
<li>Employees Database</li>
<li>Departments Tracker</li>
<li>Payroll Management System</li>
<li>Time Off Request Platform</li>
<li>Performance Review Module</li>
</ol>

<h2>Getting Started with UnDB's HR Template</h2>

<p>Follow these steps to implement our HR solution:</p>

<ol>
<li>Import the HR template to your UnDB workspace</li>
<li>Customize fields and views to match your organization</li>
<li>Input employee and department data</li>
<li>Configure leave request and performance review workflows</li>
<li>Start tracking payroll and departmental budgets</li>
</ol>

<h2>Frequently Asked Questions</h2>

<h3>Q: Is UnDB's HR template suitable for small businesses?</h3>
<p>A: Yes, our template is scalable and can be customized for businesses of all sizes.</p>

<h3>Q: Can I integrate this template with other HR tools?</h3>
<p>A: UnDB offers various integration options. Contact our support team for specific integration queries.</p>

<h3>Q: How secure is the employee data in this system?</h3>
<p>A: We prioritize data security with encryption and access controls. </p>

<p>Transform your HR processes today with UnDB's comprehensive Human Resource Management template!</p>

`,
template: {
type: "base",
template: templates.hr as IBaseTemplateDTO,
},
},
{
id: "6ba7b816-9dad-11d1-80b4-00c04fd430c8",
icon: "🔍",
name: "Agile Development Management",
categories: ["development", "agile", "startup"],
cover: getTemplateImage("agileDevelopment", "cover.jpg"),
images: [
getTemplateImage("agileDevelopment", "image1.png"),
getTemplateImage("agileDevelopment", "image2.png"),
getTemplateImage("agileDevelopment", "image3.png"),
],
description: "A template for managing agile development projects, including requirements, tasks, and defects.",
detail: `
<h1>Optimize Your Agile Development Process: UnDB's Agile Development Management Template</h1>

<h2>Comprehensive Agile Development Management Features</h2>
<p>UnDB's Agile Development Management template offers a powerful set of tools to enhance your agile development process:</p>
<ul>
<li>Requirements Management: Easily create, assign, and track project requirements</li>
<li>Task Tracking: Efficiently manage and monitor development tasks</li>
<li>Defect Management: Track and resolve software defects</li>
<li>Iteration Planning: Plan and manage sprints or iterations</li>
<li>Test Case Management: Create and execute test cases</li>
<li>Team Management: Organize and track team members' contributions</li>
<li>Time Tracking: Monitor time spent on tasks and projects</li>
</ul>

<h2>Why Choose UnDB for Agile Development Management?</h2>
<p>UnDB offers unique advantages for your agile development needs:</p>
<ul>
<li>Customizable: Tailor the template to fit your specific agile methodology and project requirements</li>
<li>User-Friendly: Intuitive interface for easy adoption across your development team</li>
<li>Scalable: Grows with your projects, from small teams to large-scale development efforts</li>
<li>Integration-Ready: Seamlessly connects with other UnDB templates and tools</li>
<li>Data-Driven: Make informed decisions with real-time project insights and analytics</li>
</ul>

<h2>Getting Started with UnDB's Agile Development Template</h2>
<p>Follow these steps to implement our agile development solution:</p>
<ol>
<li>Import the Agile Development template to your UnDB workspace</li>
<li>Customize fields and views to match your team's agile processes</li>
<li>Input your project requirements and create initial tasks</li>
<li>Set up iterations or sprints and assign team members</li>
<li>Start tracking progress, managing defects, and monitoring team performance</li>
</ol>

<p>Transform your agile development process today with UnDB's comprehensive Agile Development Management template!</p>
`,
template: {
type: "base",
template: templates.agileDevelopment as IBaseTemplateDTO,
},
},
{
id: "550e8400-e29b-41d4-a716-446655440000",
icon: "🚀",
Expand Down Expand Up @@ -236,46 +387,6 @@ export const templateData: ITemplateDTO[] = [
template: templates.socialMediaContent as IBaseTemplateDTO,
},
},
// {
// id: "6ba7b815-9dad-11d1-80b4-00c04fd430c8",
// icon: "👨‍👧‍👦",
// name: "Human Resource Management",
// categories: ["hr"],
// cover: getTemplateImage("hr", "cover.jpg"),
// images: [getTemplateImage("hr", "image1.png"), getTemplateImage("hr", "image2.png")],
// description: "A template for managing human resources, including employees, positions, and departments.",
// detail: `
// <h1>Streamline Your Human Resource Management with UnDB's HR Management Template</h1>
// <h2>Comprehensive HR Management Features</h2>
// <p>UnDB's HR Management template offers a powerful set of tools to enhance your human resource management:</p>
// <ul>
// <li>Employee Management: Easily create, assign, and monitor employee records</li>
// <li>Department Organization: Efficiently structure and manage company departments</li>
// <li>Payroll Administration: Track and manage employee compensation, including salaries, bonuses, and benefits</li>
// <li>Performance Evaluation: Set up and conduct regular performance reviews and goal-setting sessions</li>
// <li>Time Off Management: Streamline the process of requesting, approving, and tracking employee leave</li>
// <li>Recruitment and Onboarding: Manage job postings, applications, and new employee onboarding processes</li>
// <li>Training and Development: Plan and track employee training programs and career development initiatives</li>
// <li>Compliance Management: Ensure adherence to labor laws and company policies</li>
// <li>Reporting and Analytics: Generate insightful reports on various HR metrics for data-driven decision making</li>
// </ul>
// <h2>Benefits of Using UnDB's HR Management Template</h2>
// <p>Implementing our HR Management template can bring numerous advantages to your organization:</p>
// <ul>
// <li>Increased Efficiency: Automate routine HR tasks and streamline workflows</li>
// <li>Improved Data Accuracy: Centralize employee information and reduce errors in record-keeping</li>
// <li>Enhanced Employee Experience: Provide self-service options for employees to access their information</li>
// <li>Better Decision Making: Leverage HR analytics to make informed strategic decisions</li>
// <li>Scalability: Easily adapt the template to your growing organization's needs</li>
// <li>Cost Savings: Reduce administrative overhead and optimize resource allocation</li>
// </ul>
// <p>Start transforming your HR processes today with UnDB's comprehensive HR Management template!</p>
// `,
// template: {
// type: "base",
// template: templates.hr as IBaseTemplateDTO,
// },
// },
]

if (env.NODE_ENV === "development") {
Expand Down
3 changes: 3 additions & 0 deletions packages/table/src/dto/create-table.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { z } from "@undb/zod"
import { createFormDTO } from "../modules/forms/dto/create-form.dto"
import { createRecordDTO } from "../modules/records/record/dto/create-record.dto"
import { createSchemaDTO, createTablesSchemaDTO } from "../modules/schema/dto/create-schema.dto"
import { fieldId } from "../modules/schema/fields/field-id.vo"
import { fieldName } from "../modules/schema/fields/field-name.vo"
import { createViewDTO } from "../modules/views/dto/create-view.dto"
import { tableId } from "../table-id.vo"
import { tableName } from "../table-name.vo"
Expand All @@ -15,6 +17,7 @@ export const createTableDTO = z.object({
spaceId: spaceIdSchema,

schema: createSchemaDTO,
fieldsOrder: z.array(fieldName.or(fieldId)).optional(),

views: createViewDTO.array().optional(),
forms: createFormDTO.array().optional(),
Expand Down
22 changes: 22 additions & 0 deletions packages/table/src/modules/schema/schema.vo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,28 @@ export class Schema extends ValueObject<Field[]> {
return new WithNewFieldSpecification(field)
}

reorderFields(fieldsOrder: string[]): Schema {
const orderedFields: Field[] = []
const fieldSet = new Set(fieldsOrder)

// 首先添加按照 fieldsOrder 排序的字段
for (const idOrName of fieldsOrder) {
const field = this.fieldMapById.get(idOrName) || this.fieldMapByName.get(idOrName)
if (field) {
orderedFields.push(field)
}
}

// 添加未在 fieldsOrder 中指定的字段
for (const field of this.fields) {
if (!fieldSet.has(field.id.value) && !fieldSet.has(field.name.value)) {
orderedFields.push(field)
}
}

return new Schema(orderedFields)
}

createField(field: Field) {
return new Schema([...this.fields, field])
}
Expand Down
4 changes: 4 additions & 0 deletions packages/table/src/table.do.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ export class TableDo extends AggregateRoot<ITableEvents> {

#createReferenceField = createReferenceField

reorderFields(fieldsOrder: string[]) {
this.schema = this.schema.reorderFields(fieldsOrder)
}

getOrderedFields(formId?: FormId, viewId?: string): Field[] {
const fields = this.schema.fields
if (formId) {
Expand Down
6 changes: 6 additions & 0 deletions packages/table/src/table.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ export class TableFactory {
}
}

for (const { table, dto } of tables) {
if (Array.isArray(dto.fieldsOrder)) {
table.reorderFields(dto.fieldsOrder)
}
}

return tables.map(({ table, dto }) => {
const records = dto.records?.map((record) => RecordDO.create(table, record)) ?? []
return { table, records }
Expand Down
2 changes: 2 additions & 0 deletions packages/template/src/dto/template-schema.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
createTablesUrlFieldDTO,
createTablesUserFieldDTO,
createViewWithoutNameDTO,
fieldId,
fieldName,
flattenCreateRecordDTO,
formName,
Expand Down Expand Up @@ -59,6 +60,7 @@ const templateFormDTO = z.record(formName, createFormWithoutNameDTO)
const basicTemplateTableDTO = z.object({
id: tableId.optional(),
schema: templateSchemaDTO,
fieldsOrder: z.array(fieldName.or(fieldId)).optional(),
views: tempalteViewDTO.optional(),
forms: templateFormDTO.optional(),

Expand Down
1 change: 1 addition & 0 deletions packages/template/src/template.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class TemplateFactory {
name,
schema,
spaceId,
fieldsOrder: table.fieldsOrder,

views,
forms,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const templateCategory = z.enum([
"startup",
"project",
"personal",
"development",
"agile",
])

export type ITemplateCategory = z.infer<typeof templateCategory>
Expand Down
Loading
Loading